-
Notifications
You must be signed in to change notification settings - Fork 334
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Using the following commands we can extract a User Assigned Managed Identity
$UserAssignedIdentity = Get-AzUserAssignedIdentity -ResourceGroupName $AutoAccount.ResourceGroupName -SubscriptionId $AutoAccount.SubscriptionId
$ClientId = $UserAssignedIdentity.ClientId
$apiVersion = "2017-09-01"
$headers=@{"secret"=$env:IDENTITY_HEADER}
# Querying the Graph API with a User ClientID
$userResponse = Invoke-RestMethod -Method Get -Uri "$($env:IDENTITY_ENDPOINT)?resource=https://graph.microsoft.com/&clientid=$ClientId&api-version=$apiVersion" -Headers $headers
# This response should give us a User Bearer Token for later use in Graph API calls
$useraccessToken = $userResponse.access_token
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request