Skip to content

Commit c0248dc

Browse files
authored
Merge pull request #8906 from MicrosoftDocs/genlin-patch-22
AB#3969 Update cannot-delete-directory-azure-portal.md
2 parents 25c2bf2 + fef9d44 commit c0248dc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

support/entra/entra-id/dir-dmns-obj/cannot-delete-directory-azure-portal.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Fixes an issue in which you can't delete a directory from the Micro
44
ms.date: 05/22/2020
55
ms.reviewer: willfid
66
ms.service: entra-id
7-
ms.custom: sap:Directory Management, has-azure-ad-ps-ref
7+
ms.custom: sap:Directory Management, no-azure-ad-ps-ref
88
---
99
# Can't delete a directory through the Azure Management Portal
1010

@@ -91,22 +91,20 @@ If you have an Azure subscription, make sure that your Azure subscription is not
9191

9292
To learn how to remove applications from your directory, read [Adding, updating, and removing an application](/azure/active-directory/develop/quickstart-register-app)
9393

94-
[!INCLUDE [Azure AD PowerShell deprecation note](~/../support/reusable-content/msgraph-powershell/includes/aad-powershell-deprecation-note.md)]
94+
You may also have to remove additional service principals. Use [Microsoft Graph PowerShell](/powershell/microsoftgraph/installation) to remove all service principals:
9595

96-
You may also have to remove additional service principals. Use Azure Active Directory module for Windows PowerShell to remove all service principals. To do this, follow these steps:
97-
98-
1. Open Azure Active Directory module for Windows PowerShell.
99-
2. Connect to the Microsoft Online Service.
100-
3. Run the following command:
96+
1. [Install Microsoft Graph PowerShell](/powershell/microsoftgraph/installation).
97+
2. Run the `Remove-MgServicePrincipal` command to remove all service principals. This command requires at least the `Application.ReadWrite.All` permission. For more information, see [Remove-MgServicePrincipal](/powershell/module/microsoft.graph.applications/remove-mgserviceprincipal?view=graph-powershell-1.0&preserve-view=true).
10198

10299
```powershell
103-
Get-MsolServicePrincipal | Remove-MsolServicePrincipal
100+
Connect-MgGraph -Scopes "Application.ReadWrite.All" -tenant <tenant-ID>
101+
Get-MgServicePrincipal | ForEach-Object { Remove-MgServicePrincipal -ServicePrincipalId $_.Id }
104102
```
105103
106104
> [!NOTE]
107105
> You may receive an error when you remove some service principals. These principals can't be removed. However, this does not prevent you from deleting your directory. The error that you receive may resemble the following:
108106
>
109-
> Remove-MsolServicePrincipal : Invalid value for parameter. Parameter Name: appPrincipalId.
107+
> Remove-MgServicePrincipal: Specified App Principal ID is Microsoft Internal.
110108
111109
## Directory has one or more Multi-Factor Authentication providers
112110

0 commit comments

Comments
 (0)