如何使用Azure RM和ResourceId访问网站的发布凭据 [英] How to access the publishing credentials of a website using Azure RM and ResourceId
问题描述
我正尝试使用Invoke-AzureRmResourceAction
和PowerShell使用AzureRm和PowerShell获得网站的发布凭据.
I'm trying to get the publishing credentials of a website using AzureRm and PowerShell using Invoke-AzureRmResourceAction
and PowerShell.
在此答案中@David Ebbo解释了如何使用ResourceName
和ResourceGroupName
作为Invoke-AzureRmResourceAction
cmdlet.我已经尝试过了,并且效果很好,并且我返回的对象具有一个Id属性,该属性看起来很像ResourceId
.
我尝试使用该ID作为ResourceId
参数,并删除了ResourceName
和ResourceGroupName
,但是我收到一条错误消息,指出该资源不存在.
In this answer @David Ebbo explains how to do it using ResourceName
and ResourceGroupName
as parameters of the Invoke-AzureRmResourceAction
cmdlet. I've tried that and it works perfectly and the object I get back has an Id property that looks a lot like a ResourceId
.
I've tried using that Id as the ResourceId
parameter and removing ResourceName
and ResourceGroupName
but I get an error saying the resource doesn't exist.
我想使用ResourceId
,因为我需要针对不同资源组中的一系列网站自动执行此操作,并且我只能(轻松)访问ResourceId
(网站的ResourceId
确实类似于我使用ResourceName
和ResourceGroupName
获得的发布凭据对象的ID.
I'd like to use ResourceId
because I need to automate this for a series of Websites in different resource groups and I only have (easy) access to the ResourceId
(and the ResourceId
of the website looks really similar to the Id of the publishing credentials object I get using ResourceName
and ResourceGroupName
).
谢谢!
推荐答案
使用以下命令对我来说效果很好:
It is working fine for me with the following command:
Invoke-AzureRmResourceAction -ResourceId /subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.Web/sites/$sitename/config/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force -Debug
这篇关于如何使用Azure RM和ResourceId访问网站的发布凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!