如何使用Azure RM和ResourceId访问网站的发布凭据 [英] How to access the publishing credentials of a website using Azure RM and ResourceId

查看:102
本文介绍了如何使用Azure RM和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解释了如何使用ResourceNameResourceGroupName作为Invoke-AzureRmResourceAction cmdlet.我已经尝试过了,并且效果很好,并且我返回的对象具有一个Id属性,该属性看起来很像ResourceId. 我尝试使用该ID作为ResourceId参数,并删除了ResourceNameResourceGroupName,但是我收到一条错误消息,指出该资源不存在.

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确实类似于我使用ResourceNameResourceGroupName获得的发布凭据对象的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆