Skip to content

Commit f698539

Browse files
authored
Refreshed, reflowed, converted to link refs (#5331)
1 parent 41e6e16 commit f698539

File tree

1 file changed

+46
-16
lines changed

1 file changed

+46
-16
lines changed
Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,90 @@
11
---
2-
title: Service principal cleanup and troubleshooting using Azure CLI | Microsoft Docs
3-
description: Learn how to cleanup and troubleshoot service principals.
4-
ms.date: 09/19/2024
2+
title: Cleanup & troubleshoot service principals using Azure CLI
3+
description: Learn how to clean up service principal resources and troubleshoot common Azure CLI errors, including permission, tenant, and authentication issues.
54
ms.service: azure-cli
65
ms.custom: devx-track-azurecli
76
keywords: azure service principal, create service principal azure, create service principal azure cli
87
---
98

109
# Cleanup & troubleshoot service principals
1110

12-
Congratulations! You learned how to create, retrieve, and work with service principals! Now that you have completed the tutorial, it's time to clean up the created service principal resources.
11+
You learned how to create, retrieve, and work with service principals. Now that you completed the
12+
tutorial, it's time to clean up the created service principal resources.
1313

1414
## Cleanup service principal resources
1515

16-
The safest way to remove all resources used in this tutorial is to use [az group delete](/cli/azure/group#az-group-delete). The `--no-wait` parameter keeps the CLI from blocking while the deletion takes place.
16+
The safest way to remove all resources used in this tutorial is to use [az group delete][08]. The
17+
`--no-wait` parameter keeps the CLI from blocking while the deletion takes place.
1718

1819
```azurecli-interactive
1920
az group delete --name myResourceGroup --no-wait
2021
```
2122

22-
If you prefer, delete individual service principals with the [az ad sp delete](/cli/azure/ad/sp#az-ad-sp-delete) command.
23+
If you prefer, delete individual service principals with the [az ad sp delete][07] command.
2324

2425
```azurecli-interactive
2526
az ad sp delete --id myServicePrincipalID
2627
```
2728

2829
## Troubleshoot service principals
2930

30-
Although you have completed the tutorial, you may still have questions regarding service principals that can be answered in this section.
31+
Although you completed the tutorial, you might still have questions regarding service principals
32+
that can be answered in this section.
3133

3234
### Insufficient privileges
3335

34-
If your account doesn't have permission to create a service principal, `az ad sp create-for-rbac` returns an error message containing "Insufficient privileges to complete the operation." Contact your Microsoft Entra administrator to obtain `User Access Administrator` or `Role Based Access Control Administrator` permissions.
36+
If your account doesn't have permission to create a service principal, `az ad sp create-for-rbac`
37+
returns an error message containing "Insufficient privileges to complete the operation." Contact
38+
your Microsoft Entra administrator to obtain `User Access Administrator` or
39+
`Role Based Access Control Administrator` permissions.
3540

3641
### Invalid tenant
3742

38-
If you have specified an invalid subscription ID, you see the error message "The request didn't have a subscription or a valid tenant level resource provider." If using variables, use the Bash `echo` command to see the value being passed to the reference command. Use [az account set](/cli/azure/account#az-account-set) to change your subscription or learn [How to manage Azure subscriptions with the Azure CLI](./manage-azure-subscriptions-azure-cli.md).
43+
If you specified an invalid subscription ID, you see the error message "The request didn't have a
44+
subscription or a valid tenant level resource provider." If using variables, use the Bash `echo`
45+
command to see the value being passed to the reference command. Use [az account set][06] to change
46+
your subscription or learn [How to manage Azure subscriptions with the Azure CLI][02].
3947

4048
### Resource group not found
4149

42-
If you have specified an invalid resource group name, you see the error message "Resource group 'name' couldn't be found." If using variables, use the Bash `echo` command to see the value being passed to both the subscription and reference commands. Use [az group list](/cli/azure/group#az-group-list) to see the resource groups for the current subscription, or learn [How to manage Azure resource groups with the Azure CLI](./manage-azure-groups-azure-cli.md).
50+
If you specified an invalid resource group name, you see the error message "Resource group 'name'
51+
couldn't be found." If using variables, use the Bash `echo` command to see the value being passed to
52+
both the subscription and reference commands. Use [az group list][09] to see the resource groups for
53+
the current subscription, or learn [How to manage Azure resource groups with the Azure CLI][01].
4354

4455
### Authorization to perform action
4556

46-
If your account doesn't have permission to assign a role, you see an error message that your account "does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/write'." Contact your Microsoft Entra administrator to manage roles.
57+
If your account doesn't have permission to assign a role, you see an error message that your account
58+
"doesn't have authorization to perform action 'Microsoft.Authorization/roleAssignments/write'."
59+
Contact your Microsoft Entra administrator to manage roles.
4760

4861
### Interactive authentication is needed
4962

50-
When signing in with password authentication, error message "...Interactive authentication is needed..." occurs if your organization requires multifactor authentication. Switch to certificate-based authentication, or consider using [managed identities](/azure/active-directory/managed-identities-azure-resources/overview).
63+
When signing in with password authentication, error message "...Interactive authentication is
64+
needed..." occurs if your organization requires multifactor authentication. Switch to
65+
certificate-based authentication, or consider using [managed identities][05].
5166

5267
### Compliant device required
5368

54-
If you try to create a service principal using a device that is not compliant with your organizations access policies, you will receive message "...Conditional Access policy requires a compliant device...". Switch to a computer that meets your organization's access policies.
69+
If you try to create a service principal using a device that's not compliant with your
70+
organization's access policies, you receive the message "...Conditional Access policy requires a
71+
compliant device...". Switch to a computer that meets your organization's access policies.
5572

5673
## See also
5774

58-
* [Application and service principal objects in Microsoft Entra ID](/azure/active-directory/develop/app-objects-and-service-principals)
59-
* [Create a service principal using the Azure portal](/azure/active-directory/develop/howto-create-service-principal-portal)
60-
* [Create an Azure service principal with Azure PowerShell](/powershell/azure/create-azure-service-principal-azureps)
75+
- [Application and service principal objects in Microsoft Entra ID][03]
76+
- [Create a service principal using the Azure portal][04]
77+
- [Create an Azure service principal with Azure PowerShell][10]
78+
79+
<!-- link references -->
80+
81+
[01]: ./manage-azure-groups-azure-cli.md
82+
[02]: ./manage-azure-subscriptions-azure-cli.md
83+
[03]: /azure/active-directory/develop/app-objects-and-service-principals
84+
[04]: /azure/active-directory/develop/howto-create-service-principal-portal
85+
[05]: /azure/active-directory/managed-identities-azure-resources/overview
86+
[06]: /cli/azure/account#az-account-set
87+
[07]: /cli/azure/ad/sp#az-ad-sp-delete
88+
[08]: /cli/azure/group#az-group-delete
89+
[09]: /cli/azure/group#az-group-list
90+
[10]: /powershell/azure/create-azure-service-principal-azureps

0 commit comments

Comments
 (0)