Azure PowerShell Container Cmdlets
Overview
The Azure PowerShell Container module provides cmdlets for managing Azure Container Instances (ACI). Use these cmdlets to create, configure, and delete container groups, view logs, and scale resources directly from the command line.
All cmdlets are prefixed with Az and are part of the Az.ContainerInstance module. Install the module with:
Install-Module -Name Az.ContainerInstance -Repository PSGallery -Force
Key Cmdlets
| Cmdlet | Description | Link | 
|---|---|---|
| New-AzContainerGroup | Create a new container group (ACI). | Details | 
| Get-AzContainerGroup | Retrieve one or more container groups. | Details | 
| Remove-AzContainerGroup | Delete a container group. | Details | 
| Get-AzContainerInstanceLog | Fetch logs from a container instance. | Details | 
| Restart-AzContainerGroup | Restart all containers within a group. | Details | 
Example: Deploy a Web App Container
This example creates a container group that runs a simple NGINX web server.
# Login to Azure Connect-AzAccount # Choose a resource group (create if it does not exist) $rg = "MyResourceGroup" New-AzResourceGroup -Name $rg -Location "EastUS" # Create the container group New-AzContainerGroup ` -ResourceGroupName $rg ` -Name "my-nginx" ` -Image "nginx:latest" ` -OsType Linux ` -IpAddressType Public ` -Port 80 # Verify deployment Get-AzContainerGroup -ResourceGroupName $rg -Name "my-nginx"
After the command completes, navigate to the public IP address shown by Get-AzContainerGroup to see the NGINX welcome page.