Forum Discussion
Aleksander780
Dec 08, 2022Copper Contributor
Microsoft Graph Remove owner of Azure Group delete the user
Hello, I have problem where I would like to remove owner of the group, but instead of the user is completely removed. I am using Azure function HTTP triggered as PowerShell with HTTPs RestMethod....
- Dec 08, 2022At the very least, try escaping $ref, as it's not an actual variable.
VasilMichev
Dec 08, 2022MVP
At the very least, try escaping $ref, as it's not an actual variable.
Aleksander780
Dec 09, 2022Copper Contributor
Just "escaping" did not help in my case, but it thrown different error which I have resolved by make URI as variable.
$URL = "https://graph.microsoft.com/v1.0/groups/$groupID/owners/$userID/`$ref"
$Remove = (Invoke-RestMethod -URI $URL -Headers $authHeader -Method DELETE -StatusCodeVariable:StatusCode)
Now it works as it should.
$URL = "https://graph.microsoft.com/v1.0/groups/$groupID/owners/$userID/`$ref"
$Remove = (Invoke-RestMethod -URI $URL -Headers $authHeader -Method DELETE -StatusCodeVariable:StatusCode)
Now it works as it should.