$headers = @{ 'Authorization' = "Bearer $accesstoken" 'Content-Type' = 'application/json' } $requesturi = "https://management.azure.com/subscriptions/$subscriptionid/resourcegroups?api-version=2021-04-01" $ret = (Invoke-RestMethod -Uri $requesturi -Headers $headers -Method Get).Value $ret