Elevate access to manage all Azure subscriptions and management groups
Άρθρο
As a Global Administrator in Microsoft Entra ID, you might not have access to all subscriptions and management groups in your tenant. This article describes the ways that you can elevate your access to all subscriptions and management groups.
If you are a Global Administrator, there might be times when you want to do the following actions:
Regain access to an Azure subscription or management group when a user has lost access
Grant another user or yourself access to an Azure subscription or management group
See all Azure subscriptions or management groups in an organization
Allow an automation app (such as an invoicing or auditing app) to access all Azure subscriptions or management groups
How does elevated access work?
Microsoft Entra ID and Azure resources are secured independently from one another. That is, Microsoft Entra role assignments do not grant access to Azure resources, and Azure role assignments do not grant access to Microsoft Entra ID. However, if you are a Global Administrator in Microsoft Entra ID, you can assign yourself access to all Azure subscriptions and management groups in your tenant. Use this capability if you don't have access to Azure subscription resources, such as virtual machines or storage accounts, and you want to use your Global Administrator privilege to gain access to those resources.
When you elevate your access, you are assigned the User Access Administrator role in Azure at root scope (/). This allows you to view all resources and assign access in any subscription or management group in the tenant. User Access Administrator role assignments can be removed using Azure PowerShell, Azure CLI, or the REST API.
You should remove this elevated access once you have made the changes you need to make at root scope.
Browse to Microsoft Entra ID > Manage > Properties.
Under Access management for Azure resources, set the toggle to Yes.
When you set the toggle to Yes, you are assigned the User Access Administrator role in Azure RBAC at root scope (/). This grants you permission to assign roles in all Azure subscriptions and management groups associated with this Microsoft Entra tenant. This toggle is only available to users who are assigned the Global Administrator role in Microsoft Entra ID.
When you set the toggle to No, the User Access Administrator role in Azure RBAC is removed from your user account. You can no longer assign roles in all Azure subscriptions and management groups that are associated with this Microsoft Entra tenant. You can view and manage only the Azure subscriptions and management groups to which you have been granted access.
Note
If you're using Privileged Identity Management, deactivating your role assignment does not change the Access management for Azure resources toggle to No. To maintain least privileged access, we recommend that you set this toggle to No before you deactivate your role assignment.
Select Save to save your setting.
This setting is not a global property and applies only to the currently signed in user. You can't elevate access for all members of the Global Administrator role.
Sign out and sign back in to refresh your access.
You should now have access to all subscriptions and management groups in your tenant. When you view the Access control (IAM) page, you'll notice that you have been assigned the User Access Administrator role at root scope.
Make the changes you need to make at elevated access.
Perform the steps in the following section to remove your elevated access.
Step 2: Remove elevated access
To remove the User Access Administrator role assignment at root scope (/), follow these steps.
Sign in as the same user that was used to elevate access.
Browse to Microsoft Entra ID > Manage > Properties.
Set the Access management for Azure resources toggle back to No. Since this is a per-user setting, you must be signed in as the same user as was used to elevate access.
If you try to remove the User Access Administrator role assignment on the Access control (IAM) page, you'll see the following message. To remove the role assignment, you must set the toggle back to No or use Azure PowerShell, Azure CLI, or the REST API.
Sign out as Global Administrator.
If you are using Privileged Identity Management, deactivate your Global Administrator role assignment.
Note
If you're using Privileged Identity Management, deactivating your role assignment does not change the Access management for Azure resources toggle to No. To maintain least privileged access, we recommend that you set this toggle to No before you deactivate your role assignment.
Step 1: Elevate access for a Global Administrator
Use the Azure portal or REST API to elevate access for a Global Administrator.
Step 2: List role assignment at root scope (/)
Once you have elevated access, to list the User Access Administrator role assignment for a user at root scope (/), use the Get-AzRoleAssignment command.
To remove the User Access Administrator role assignment for yourself or another user at root scope (/), follow these steps.
Sign in as a user that can remove elevated access. This can be the same user that was used to elevate access or another Global Administrator with elevated access at root scope.
Use the Remove-AzRoleAssignment command to remove the User Access Administrator role assignment.
Perform the steps in a later section to remove your elevated access.
Step 2: List role assignment at root scope (/)
Once you have elevated access, to list the User Access Administrator role assignment for a user at root scope (/), use the az role assignment list command.
az role assignment list --role "User Access Administrator" --scope "/"
To remove the User Access Administrator role assignment for yourself or another user at root scope (/), follow these steps.
Sign in as a user that can remove elevated access. This can be the same user that was used to elevate access or another Global Administrator with elevated access at root scope.
Perform the steps in a later section to remove your elevated access.
Step 2: List role assignments at root scope (/)
Once you have elevated access, you can list all of the role assignments for a user at root scope (/).
Call Role Assignments - List For Scope where {objectIdOfUser} is the object ID of the user whose role assignments you want to retrieve.
GET https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+'{objectIdOfUser}'
Step 3: List deny assignments at root scope (/)
Once you have elevated access, you can list all of the deny assignments for a user at root scope (/).
Call Deny Assignments - List For Scope where {objectIdOfUser} is the object ID of the user whose deny assignments you want to retrieve.
GET https://management.azure.com/providers/Microsoft.Authorization/denyAssignments?api-version=2022-04-01&$filter=gdprExportPrincipalId+eq+'{objectIdOfUser}'
Step 4: Remove elevated access
When you call elevateAccess, you create a role assignment for yourself, so to revoke those privileges you need to remove the User Access Administrator role assignment for yourself at root scope (/).
Call Role Definitions - Get where roleName equals User Access Administrator to determine the name ID of the User Access Administrator role.
GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter=roleName+eq+'User Access Administrator'
Save the ID from the name parameter, in this case 18d7d88d-d35e-4fb5-a5c3-7773c20a72d9.
You also need to list the role assignment for the tenant administrator at tenant scope. List all assignments at tenant scope for the principalId of the tenant administrator who made the elevate access call. This will list all assignments in the tenant for the objectid.
GET https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+'{objectid}'
Note
A tenant administrator should not have many assignments. If the previous query returns too many assignments, you can also query for all assignments just at tenant scope, then filter the results:
GET https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=atScope()
The previous calls return a list of role assignments. Find the role assignment where the scope is "/" and the roleDefinitionId ends with the role name ID you found in step 1 and principalId matches the objectId of the tenant administrator.
If you have users with elevated access, banners are displayed in a couple locations of the Azure portal. This section describes how to determine if you have users that have elevated access in your tenant. This capability is being deployed in stages, so it might not be available yet in your tenant.
Option 1
In the Azure portal, browse to Microsoft Entra ID > Manage > Properties.
Under Access management for Azure resources, look for the following banner.
You have X users with elevated access. Microsoft Security recommends deleting access for users who have unnecessary elevated access. Manage elevated access users
Select the Manage elevated access users link to view a list of users with elevated access.
Option 2
In the Azure portal, browse to a subscription.
Select Access control (IAM).
At the top of the page, look for the following banner.
Action required: X users have elevated access in your tenant. You should take immediate action and remove all role assignments with elevated access. View role assignments
Select the View role assignments link to view a list of users with elevated access.
Remove elevated access for users
If you have users with elevated access, you should take immediate action and remove that access. To remove these role assignments, you must also have elevated access. This section describes how to remove elevated access for users in your tenant using the Azure portal. This capability is being deployed in stages, so it might not be available yet in your tenant.
Sign in to the Azure portal as a Global Administrator.
Browse to Microsoft Entra ID > Manage > Properties.
The Users with elevated access appears pane appears with a list of users with elevated access in your tenant.
To remove elevated access for users, add a check mark next to the user and select Remove.
View elevate access log entries
When access is elevated or removed, an entry is added to the logs. As an administrator in Microsoft Entra ID, you might want to check when access was elevated and who did it.
Elevate access log entries appear in both the Microsoft Entra directory audit logs and the Azure activity logs. Elevated access log entries for directory audit logs and activity logs include similar information. However, the directory audit logs are easier to filter and export. Also, the export capability enables you to stream access events, which can be used for your alert and detection solutions, such as Microsoft Sentinel or other systems. For information about how to send logs to different destinations, see Configure Microsoft Entra diagnostic settings for activity logs.
This section describes different ways that you can view the elevate access log entries.
Elevate access log entries in the Microsoft Entra directory audit logs is currently in preview.
This preview version is provided without a service level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities.
For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Sign in to the Azure portal as a Global Administrator.
Browse to Microsoft Entra ID > Monitoring > Audit logs.
In the Service filter, select Azure RBAC (Elevated Access) and then select Apply.
Elevated access logs are displayed.
To view details when access was elevated or removed, select these audit log entries.
User has elevated their access to User Access Administrator for their Azure Resources
The role assignment of User Access Administrator has been removed from the user
To download and view the payload of the log entries in JSON format, select Download and JSON.
View elevate access log entries using the Azure portal
Sign in to the Azure portal as a Global Administrator.
Browse to Monitor > Activity log.
Change the Activity list to Directory Activity.
Search for the following operation, which signifies the elevate access action.
Assigns the caller to User Access Administrator role
View elevate access log entries using Azure CLI
Use the az login command to sign in as Global Administrator.
Use the az rest command to make the following call where you will have to filter by a date as shown with the example timestamp and specify a filename where you want the logs to be stored.
The url calls an API to retrieve the logs in Microsoft.Insights. The output will be saved to your file.
az rest --url "https://management.azure.com/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2021-09-10T20:00:00Z'" > output.txt
In the output file, search for elevateAccess.
The log will resemble the following where you can see the timestamp of when the action occurred and who called it.
Delegate access to a group to view elevate access log entries using Azure CLI
If you want to be able to periodically get the elevate access log entries, you can delegate access to a group and then use Azure CLI.
Browse to Microsoft Entra ID > Groups.
Create a new security group and note the group object ID.
Use the az login command to sign in as Global Administrator.
Use the az role assignment create command to assign the Reader role to the group who can only read logs at the tenant level, which are found at Microsoft/Insights.
az role assignment create --assignee "{groupId}" --role "Reader" --scope "/providers/Microsoft.Insights"
Add a user who will read logs to the previously created group.
A user in the group can now periodically run the az rest command to view elevate access log entries.
az rest --url "https://management.azure.com/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2021-09-10T20:00:00Z'" > output.txt