Skip to content

Commit 0e61984

Browse files
Merge pull request #17357 from sethmanheim/hub-graph314
Updates to Graph API retirement steps/script
2 parents 9d0bcdd + 82047be commit 0e61984

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

azure-stack/operator/graph-api-retirement.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to mitigate the retirement of the Entra ID Graph API.
44
author: sethmanheim
55
ms.author: sethm
66
ms.topic: conceptual
7-
ms.date: 02/25/2025
7+
ms.date: 03/14/2025
88
ms.reviewer: rtiberiu
99

1010
---
@@ -26,12 +26,12 @@ To ensure that your Azure Stack Hub environments that use Entra ID as an identit
2626
2727
## Run the script
2828

29-
Run the following PowerShell script in your Entra ID environment that is used by Azure Stack Hub as the "home directory" (the main identity provider of your Azure Stack Hub). The script interacts with Azure, so you don't need to run it on a specific machine. However, you need at least "application administrator" privileges in the respective Entra ID tenant to run the script.
29+
Run the following PowerShell script in your Entra ID environment that's used by Azure Stack Hub as the *home directory* (the main identity provider of your Azure Stack Hub), as well as the Entra ID environment to which you registered your Azure Stack Hub system. This might be a different directory than your home directory. The script interacts with Azure, so you don't need to run it on a specific machine. However, you need at least **application administrator** privileges in the respective Entra ID tenant to run the script.
3030

3131
Make sure to run the following script with administrator privileges on the local machine:
3232

3333
```powershell
34-
# Install the graph modules if necessary
34+
# Install the Graph modules if necessary
3535
#Install-Module Microsoft.Graph.Authentication
3636
#Install-Module Microsoft.Graph.Applications
3737
@@ -42,22 +42,22 @@ Import-Module Microsoft.Graph.Applications
4242
# Repeat this flow for each of your target directory tenants
4343
$tenantId = 'MyTenantId'
4444
45-
# Sign-in with admin permissions to read and write all application objects
45+
# Sign in with admin permissions to read and write all application objects
4646
Connect-MgGraph -TenantId $tenantId -Scopes Application.ReadWrite.All
4747
4848
# Retrieve all applications in the current directory
4949
Write-Host "Looking-up all applications in directory '$tenantId'..."
5050
$applications = Get-MgApplication -All -Property id, displayName, appId, identifierUris, requiredResourceAccess, authenticationBehaviors
5151
Write-Host "Found '$($applications.Count)' total applications in directory '$tenantId'"
5252
53-
# Find all the unique deployment guids, each one representing an Azure Stack deployment in the current directory
53+
# Find all the unique deployment GUIDs, each one representing an Azure Stack deployment or registration in the current directory
5454
$deploymentGuids = $applications.IdentifierUris |
55-
Where-Object { $_ -like 'https://management.*' -or $_ -like 'https://adminmanagement.*' } |
55+
Where-Object { $_ -like 'https://management.*' -or $_ -like 'https://adminmanagement.*' -or $_ -like 'https://azurebridge.*' } |
5656
ForEach-Object { "$_".Split('/')[3] } |
5757
Select-Object -Unique
58-
Write-Host "Found '$($deploymentGuids.Count)' total Azure Stack deployments in directory '$tenantId'"
58+
Write-Host "Found '$($deploymentGuids.Count)' total Azure Stack deployments or registrations in directory '$tenantId'"
5959
60-
# Find all the Azure Stack application objects for each deployment
60+
# Find all the Azure Stack application objects for each deployment or registration
6161
$azureStackApplications = @()
6262
foreach ($application in $applications)
6363
{
@@ -66,19 +66,22 @@ foreach ($application in $applications)
6666
if (($application.IdentifierUris -join '') -like "*$deploymentGuid*")
6767
{
6868
$azureStackApplications += $application
69+
break
6970
}
7071
}
7172
}
7273
73-
# Find which Azure Stack applications require access to Legacy Graph Service
74+
# Find which Azure Stack applications require access to the legacy Graph Service
7475
$azureStackLegacyGraphApplications = $azureStackApplications |
75-
Where-Object { $_.RequiredResourceAccess.ResourceAppId -contains '00000002-0000-0000-c000-000000000000' }
76+
Where-Object {
77+
($_.RequiredResourceAccess.ResourceAppId -contains '00000002-0000-0000-c000-000000000000') -or
78+
($_.IdentifierUris | Where-Object { $_ -like 'https://azurebridge.*' }) }
7679
77-
# Find which of those applications need to have their authentication behaviors patched to allow access to Legacy Graph
80+
# Find which of those applications need to have their authentication behaviors patched to allow access to legacy Graph
7881
$azureStackLegacyGraphApplicationsToUpdate = $azureStackLegacyGraphApplications |
7982
Where-Object { -not ($ab = $_.AdditionalProperties.authenticationBehaviors) -or -not $ab.ContainsKey(($key='blockAzureADGraphAccess')) -or $ab[$key] }
8083
81-
# Update the applications which require their authentication behaviors patched to allow access to Legacy Graph
84+
# Update the applications that require their authentication behaviors patched to allow access to legacy Graph
8285
Write-Host "Found '$($azureStackLegacyGraphApplicationsToUpdate.Count)' total Azure Stack applications which need permission to continue calling Legacy Microsoft Graph Service"
8386
$count = 0
8487
foreach ($application in $azureStackLegacyGraphApplicationsToUpdate)

0 commit comments

Comments
 (0)