|
| 1 | +--- |
| 2 | +title: Remove access to a delegation |
| 3 | +description: Learn how to onboard a customer to Azure delegated resource management, allowing their resources to be accessed and managed through your own tenant. |
| 4 | +ms.date: 04/23/2020 |
| 5 | +ms.topic: conceptual |
| 6 | +--- |
| 7 | + |
| 8 | +# Remove access to a delegation |
| 9 | + |
| 10 | +This article explains how you, as a service provider, can remove access to a subscription or resource group that was previously delegated to Azure delegated resource management. |
| 11 | + |
| 12 | +By default, users in the customer's tenant who have the appropriate permissions can remove service provider access to delegated resources in the [Service providers page](view-manage-service-providers.md#add-or-remove-service-provider-offers) of the Azure portal. When they do so, no users in the service provider's tenant will be able to access the resources that had been previously delegated. |
| 13 | + |
| 14 | +If you have onboarded users with the [Managed Services Registration Assignment Delete Role](../../role-based-access-control/built-in-roles.md#managed-services-registration-assignment-delete-role) when onboarding a customer for Azure delegated resource management, those users will also be able to remove the delegation. |
| 15 | + |
| 16 | +> [!TIP] |
| 17 | +> We recommend assigning the [Managed Services Registration Assignment Delete Role](../../role-based-access-control/built-in-roles.md#managed-services-registration-assignment-delete-role) when onboarding a customer, so that users in your tenant can [remove access to the delegation](#remove-access-to-a-delegation) later if needed. If this role is not assigned, delegated resources can only be removed by a user in the customer's tenant. |
| 18 | +
|
| 19 | +The example below shows an assignment granting the **Managed Services Registration Assignment Delete Role** that can be included in a parameter file: |
| 20 | + |
| 21 | +```json |
| 22 | + "authorizations": [ |
| 23 | + { |
| 24 | + "principalId": "cfa7496e-a619-4a14-a740-85c5ad2063bb", |
| 25 | + "principalIdDisplayName": "MSP Operators", |
| 26 | + "roleDefinitionId": "91c1777a-f3dc-4fae-b103-61d183457e46" |
| 27 | + } |
| 28 | + ] |
| 29 | +``` |
| 30 | + |
| 31 | +A user with this permission can remove a delegation in one of the following ways. |
| 32 | + |
| 33 | +### Azure portal |
| 34 | + |
| 35 | +1. Navigate to the [My customers page](view-manage-customers.md). |
| 36 | +2. Select **Delegations**. |
| 37 | +3. Find the delegation you want to remove, then select the trash can icon that appears in its row. |
| 38 | + |
| 39 | +### PowerShell |
| 40 | + |
| 41 | +```azurepowershell-interactive |
| 42 | +# Log in first with Connect-AzAccount if you're not using Cloud Shell |
| 43 | +
|
| 44 | +# Sign in as a user from the managing tenant directory |
| 45 | +
|
| 46 | +Login-AzAccount |
| 47 | +
|
| 48 | +# Select the subscription that is delegated - or contains the delegated resource group(s) |
| 49 | +
|
| 50 | +Select-AzSubscription -SubscriptionName "<subscriptionName>" |
| 51 | +
|
| 52 | +# Get the registration assignment |
| 53 | +
|
| 54 | +Get-AzManagedServicesAssignment -Scope "/subscriptions/{delegatedSubscriptionId}" |
| 55 | +
|
| 56 | +# Delete the registration assignment |
| 57 | +
|
| 58 | +Remove-AzManagedServicesAssignment -ResourceId "/subscriptions/{delegatedSubscriptionId}/providers/Microsoft.ManagedServices/registrationAssignments/{assignmentGuid}" |
| 59 | +``` |
| 60 | + |
| 61 | +### Azure CLI |
| 62 | + |
| 63 | +```azurecli-interactive |
| 64 | +# Log in first with az login if you're not using Cloud Shell |
| 65 | +
|
| 66 | +# Sign in as a user from the managing tenant directory |
| 67 | +
|
| 68 | +az login |
| 69 | +
|
| 70 | +# Select the subscription that is delegated – or contains the delegated resource group(s) |
| 71 | +
|
| 72 | +az account set -s <subscriptionId/name> |
| 73 | +
|
| 74 | +# List registration assignments |
| 75 | +
|
| 76 | +az managedservices assignment list |
| 77 | +
|
| 78 | +# Delete the registration assignment |
| 79 | +
|
| 80 | +az managedservices assignment delete --assignment <id or full resourceId> |
| 81 | +``` |
| 82 | + |
| 83 | +## Next steps |
| 84 | + |
| 85 | +- Learn about [cross-tenant management experiences](../concepts/cross-tenant-management-experience.md). |
| 86 | +- [View and manage customers](view-manage-customers.md) by going to **My customers** in the Azure portal. |
0 commit comments