Reputation: 1897
Is there an alternate way using managed identity or basic authentication to do some testing with Fabric update API's, as creation of Entra ID has some restrictions for me atm. Code I am using to generate access token to call the main API. Is there any other way to update workspaces using SDK's or cmdlets?
# Define the OAuth token endpoint URL
$tokenUrl = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"
# Scope
$scope = "https://api.fabric.microsoft.com/.default"
# Adjust scope if needed
# Body for the token request
$body = @{
client_id = $clientId
scope = $scope
client_secret = $clientSecret
grant_type = "client_credentials"
}
# Make the HTTP request to get the token
$response = Invoke-RestMethod -Uri $tokenUrl -Method Post -ContentType "application/x-www-form-urlencoded" -Body $body
# Extract the access token from the response
$accessToken = $response.access_token
# Output the access token
Write-Host "Access Token: $accessToken"
Write-Host "##vso[task.setvariable variable=AccessToken]$accessToken"
Upvotes: 0
Views: 41