0

I'm trying to get the publishing credentials of a website using AzureRm and PowerShell using Invoke-AzureRmResourceAction and PowerShell.

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.

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).

Thanks!

Community
  • 1
  • 1
Antón Molleda
  • 684
  • 5
  • 15

1 Answers1

2

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
David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • I found what was going on. The id I get from running it with ResourceName is something like this `/subscriptions/$id/resourceGroups/$rg/providers/Microsoft.Web/sites/$website/publishingcredentials/$website` I tried removing the `$website` at the end but I was missing a `/config/` between `/$website` and `/publishingprofile` Thanks! – Antón Molleda Apr 22 '16 at 22:45