PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,914 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
According to the documentation here it is possible to call Azure API's to configure PIM for Azure resources, I am trying to set this up at the subscription level, i.e contributor for a subscription.
I have the script as follows.
Connect-AzAccount
# Variables
I get the error.
Invoke-RestMethod : {"error":{"code":"SubjectNotFound","message":"The subject is not found."}}
At line:1 char:13
+ $response = Invoke-RestMethod -Method Put -Uri $url -Headers $headers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand