如何使用 Azure RM 和 ResourceId 访问网站的发布凭据
How to access the publishing credentials of a website using Azure RM and ResourceId
我正在尝试使用 Invoke-AzureRmResourceAction
和 PowerShell 获取使用 AzureRm 和 PowerShell 的网站的发布凭据。
在 this answer @David Ebbo 中解释了如何使用 ResourceName
和 ResourceGroupName
作为 Invoke-AzureRmResourceAction
cmdlet 的参数。我试过了,它运行良好,我取回的对象有一个 ID 属性,看起来很像 ResourceId
。
我尝试使用该 ID 作为 ResourceId
参数并删除 ResourceName
和 ResourceGroupName
但我收到一条错误消息,指出该资源不存在。
我想使用 ResourceId
,因为我需要为不同资源组中的一系列网站自动执行此操作,而且我只能(轻松)访问 ResourceId
(以及 ResourceId
的网站看起来非常类似于我使用 ResourceName
和 ResourceGroupName
).
获得的发布凭据对象的 ID
谢谢!
使用以下命令对我来说工作正常:
Invoke-AzureRmResourceAction -ResourceId /subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$sitename/config/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force -Debug
我正在尝试使用 Invoke-AzureRmResourceAction
和 PowerShell 获取使用 AzureRm 和 PowerShell 的网站的发布凭据。
在 this answer @David Ebbo 中解释了如何使用 ResourceName
和 ResourceGroupName
作为 Invoke-AzureRmResourceAction
cmdlet 的参数。我试过了,它运行良好,我取回的对象有一个 ID 属性,看起来很像 ResourceId
。
我尝试使用该 ID 作为 ResourceId
参数并删除 ResourceName
和 ResourceGroupName
但我收到一条错误消息,指出该资源不存在。
我想使用 ResourceId
,因为我需要为不同资源组中的一系列网站自动执行此操作,而且我只能(轻松)访问 ResourceId
(以及 ResourceId
的网站看起来非常类似于我使用 ResourceName
和 ResourceGroupName
).
谢谢!
使用以下命令对我来说工作正常:
Invoke-AzureRmResourceAction -ResourceId /subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$sitename/config/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force -Debug