How to start stop azure container instance using Powershell command or ARM command
You can use the PowerShell cmdlet to stop the ACI and the cmdlet will like this:
Invoke-AzureRmResourceAction -ResourceGroupName yourResourceGroup -ResourceName yourContainerGroup -Action Stop -ResourceType Microsoft.ContainerInstance/containerGroups
The result of the PowerShell cmdlet like this:
Also, it shows the state on the Azure Portal:
To perform this action using the newer Powershell 'Az' modules:
$cg = Get-AzContainerGroup -ResourceGroupName <yourResourceGroupName> -Name <yourContainerGroupName>Invoke-AzResourceAction -ResourceId $cg.Id -Action start -Force
The Action
parameter can be start
, stop
, restart
.
I got those possible values from the Azure Resource Explorer: https://resources.azure.com/providers/Microsoft.ContainerInstance/operations