Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add User Assigned Managed Identity #26

Open
goosvorbook opened this issue Oct 17, 2022 · 0 comments
Open

Add User Assigned Managed Identity #26

goosvorbook opened this issue Oct 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@goosvorbook
Copy link
Contributor

goosvorbook commented Oct 17, 2022

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
@kfosaaen kfosaaen added the enhancement New feature or request label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants