Forum Discussion
SimonPl
1 year agoNew Member
Fabric REST API endpoints for GCC
Hi, Context: I am trying to run a PowerShell script using the Fabric REST APIs. We are working in a multi-tenant environment, so the idea is to run the script using a DevOps pipeline. The source...
- 1 year ago
Thank you for the reply! In the end, we found the following:
- We were initially using PowerShell command (Get-AzAccessToken -ResourceUrl $fabricResourceUrl).Token to request our access token for a personal user.
- We found out that any access token generated in this way on a GCC description does not provide access to any of the Fabric services. Since we are working with a service principal, we tried a different way of getting our access token:
$appId = $env:servicePrincipalId $clientSecret = $env:servicePrincipalKey $tenantId = $env:tenantId $authority = "https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token" # access token $body = @{ client_id = $appId scope = "$fabricResourceUrl/.default" client_secret = $clientSecret grant_type = "client_credentials" } $response = Invoke-RestMethod -Method Post -Uri $authority -ContentType "application/x-www-form-urlencoded" -Body $body $fabricToken = $response.access_token- This new method for token retrieval resolved the issues we were having. We could use exactly the same Fabric endpoints for GCC, but now with a valid access token. I do not have a clear explanation on why this resolves the issue.
v-prasare
1 year agoCommunity Support
Hi SimonPl ,
We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
ibarrau & burakkaragoz , thanks for your prompt response.
Thanks,
Prashanth Are
MS Fabric community support
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.