如何在 PowerShell 中使用 Azure CLI 取消分配 Azure VM?
要使用AzureCLI解除分配AzureVM,我们需要使用VM解除分配命令azvmdeallocate并需要提供VM的名称和VM的资源组。
在运行解除分配命令之前,请确保您已连接到正确的azure订阅和azure帐户。
PS C:\> az vm deallocate -n VMName -g RGName --verbose
或者你可以使用
PS C:\> az vm deallocate --name VMName --resource-group RGName --verbose
如果您正在处理多个VM,您还可以应用--no-wait 参数来继续下一个操作,而无需等待VM停止。
PS C:\> az vm deallocate -n VmName -g RGName --no-wait --verbose