Skip to content

Add User Assigned Managed Identity #26

@goosvorbook

Description

@goosvorbook

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

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions