How can we improve Azure Cloud Shell?

Add-AzureADDirectoryRoleMember fails if it is run on Azure Cloud Shell

Add-AzureADDirectoryRoleMember fails if it is run on Azure Cloud Shell. Internal graph api query might have additional slash ('/') in the request.

PS Azure:\> Add-AzureADDirectoryRoleMember -ObjectId 803d8e7d-6860-409f-adbf-a235bcf7e5e5 -RefObjectId 21d744cb-375e-4af7-b7f7-2f049c54bf63
Add-AzureADDirectoryRoleMember : Error occurred while executing AddDirectoryRoleMember
Code: Request_BadRequest
Message: The URI 'https://graph.windows.net//d7a85814-4d89-4baf-8a8a-f5be8306a959/directoryObjects/21d744cb-375e-4af7-b7f7-2f049c54bf63'; is not valid since it is not based on 'https://graph.windows.net/d7a85814-4d89-4baf-8a8a-f5be8306a959/'.
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:1 char:1
+ Add-AzureADDirectoryRoleMember -ObjectId 803d8e7d-6860-409f-adbf-a235 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-AzureADDirectoryRoleMember], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.AddDirectoryRoleMember

2 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

Jun Takata shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base