How do I call this service using az devops invoke?
https://learn.microsoft.com/en-us/rest/api/azure/devops/ims/?view=azure-devops-rest-7.1
Specifically with the following query parameters:
When I access this in a browser it returns data. I've been trying to do the same with the cli:
az devops invoke `
--query-parameters searchFilter=General filterValue=$($identity_name) queryMembership=None `
--org "https://vssps.dev.azure.com/$orgName" `
--area IMS `
--resource Identity `
--api-version 7.1
I get the following warning and error: The Azure DevOps Extension for the Azure CLI does not support Azure DevOps Server. The requested resource does not support http method 'GET'.
I can reproduce the same error when using the same script as yours.
There are two mistakes in your script:
The correct value of '--org
' should be the URL of Azure DevOps organization "https://dev.azure.com/$orgName
".
The correct value of '--resource
' should be 'Identities
'.
So, you need to update your script like as below.
$pat="xxxx"
$orgName="xxxx"
$identity_name = "xxxx"
Write-Output $pat | az devops login --org https://dev.azure.com/$orgName
az devops invoke `
--org https://dev.azure.com/$orgName `
--query-parameters searchFilter=General filterValue=$identity_name queryMembership=None `
--area IMS `
--resource Identities `
--api-version 7.1