本文介绍了如何使用Powershell命令或ARM命令启动停止Azure容器实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以使用以下命令从Azure CLI启动/停止容器实例az容器停止--name mycontainer-资源组myResourceGroupVM

但是由于在我的组织中,azure cli给出了访问被拒绝"错误,所以我想知道如何使用Powershell或ARM进行相同的操作.我无法从文档中获取任何Powershell cmdlet来启动或停止Conrainer实例.请帮忙.

我参考了以下文档:

此外,它还在Azure门户上显示状态:

I know you can start / stop container instance from Azure CLI using below commandaz container stop --name mycontainer --resource-group myResourceGroupVM

but since in my org azure cli gives "Access is denied" error i want to know how to do same using powershell or ARM. I am unable to get any powershell cmdlet to start or stop conrainer instance from documentation. Please help.

I referred below documentation for same:https://docs.microsoft.com/en-us/powershell/module/azurerm.containerinstance/?view=azurermps-6.9.0#container_instances

Also could anyone tell me why I get "Access is denied." for all az (CLI ) commands?

解决方案

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:

这篇关于如何使用Powershell命令或ARM命令启动停止Azure容器实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 10:05