Skip to content

Commit da8404e

Browse files
authored
Merge pull request #219632 from v-edmckillop/patch-23
Update service-accounts-principal.md
2 parents 1bd0770 + 4933511 commit da8404e

File tree

1 file changed

+43
-39
lines changed

1 file changed

+43
-39
lines changed

articles/active-directory/fundamentals/service-accounts-principal.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,85 +8,83 @@ ms.service: active-directory
88
ms.workload: identity
99
ms.subservice: fundamentals
1010
ms.topic: conceptual
11-
ms.date: 08/20/2022
11+
ms.date: 11/28/2022
1212
ms.author: jricketts
1313
ms.reviewer: ajburnle
1414
ms.custom: "it-pro, seodec18"
1515
ms.collection: M365-identity-device-management
1616
---
1717

18-
# Securing service principals
18+
# Securing service principals
1919

20-
An Azure Active Directory (Azure AD) [service principal](../develop/app-objects-and-service-principals.md) is the local representation of an application object in a single tenant or directory. It functions as the identity of the application instance. Service principals define who can access the application, and what resources the application can access. A service principal is created in each tenant where the application is used and references the globally unique application object. The tenant secures the service principal’s sign in and access to resources.
20+
An Azure Active Directory (Azure AD) [service principal](../develop/app-objects-and-service-principals.md) is the local representation of an application object in a single tenant or directory. It functions as the identity of the application instance. Service principals define who can access the application, and what resources the application can access. A service principal is created in each tenant where the application is used, and references the globally unique application object. The tenant secures the service principal sign-in and access to resources.
2121

2222
### Tenant-service principal relationships
23-
A single-tenant application has only one service principal in its home tenant. A multi-tenant web application or API requires a service principal in each tenant. A service principal is created when a user from that tenant has consented to the application's or API's use. ​This consent creates a one-to-many relationship between the multi-tenant application and its associated service principals.
2423

25-
A multi-tenant application is homed in a single tenant and is designed to have instances in other tenants. Most software-as-a-service (SaaS) applications are designed for multi-tenancy.
26-
Use service principals to ensure the right security posture for the application and its users in both single tenant and multi-tenant use cases.
24+
A single-tenant application has one service principal in its home tenant. A multi-tenant web application or API requires a service principal in each tenant. A service principal is created when a user from that tenant consents to use of the application or API. This consent creates a one-to-many relationship between the multi-tenant application and its associated service principals.
25+
26+
A multi-tenant application is homed in a single tenant and has instances in other tenants. Most software-as-a-service (SaaS) applications accommodate multi-tenancy. Use service principals to ensure the needed security posture for the application and its users in single-tenant and multi-tenant scenarios.
2727

2828
## ApplicationID and ObjectID
2929

30-
A given application instance has two distinct properties: the ApplicationID (also known as ClientID) and the ObjectID.
30+
An application instance has two properties: the ApplicationID (also known as ClientID) and the ObjectID.
3131

3232
> [!NOTE]
33-
> You may find that the terms application and service principal are used interchangeably when loosely referring to an application in the context of authentication related tasks. However, they are two different representations of applications in Azure AD.
33+
> It's possible the terms application and service principal are used interchangeably when referring to an application in the context of authentication-related tasks. However, they are two representations of applications in Azure AD.
3434
35+
The ApplicationID represents the global application and is the same for application instances across tenants. The ObjectID is a unique value for an application object. As with users, groups, and other resources, the ObjectID helps to identify an application instance in Azure AD.
3536

36-
The ApplicationID represents the global application and is the same for all the application instances across tenants. The ObjectID is a unique value for an application object. As with users, groups, and other resources, the ObjectID helps uniquely identify an application instance in Azure AD.
37-
38-
​​For more detailed information on this topic, see [Application and service principal relationship](../develop/app-objects-and-service-principals.md).
37+
To learn more, see [Application and service principal relationship](../develop/app-objects-and-service-principals.md).
3938

40-
You can also create an application and its service principal object (ObjectID) in a tenant using Azure PowerShell, Azure CLI, Microsoft Graph, the Azure portal, and other tools.
39+
You can create an application and its service principal object (ObjectID) in a tenant using Azure PowerShell, Azure CLI, Microsoft Graph, the Azure portal, and other tools.
4140

4241
![Screen shot showing a new application registration, with the Application ID and Object ID fields highlighted.](./media/securing-service-accounts/secure-principal-image-1.png)
4342

4443
## Service principal authentication
4544

46-
There are two mechanisms for authentication using service principals—client certificates and client secrets.
45+
When using service principals—client certificates and client secrets, there are two mechanisms for authentication.
4746

4847
![ Screen shot of New App page showing the Certificates and client secrets areas highlighted.](./media/securing-service-accounts/secure-principal-certificates.png)
4948

50-
Certificates are more secure: use client certificates if possible. Unlike client secrets, client certificates cannot accidentally be embedded in code. Use Azure Key Vault for certificate and secrets management when possible to encrypt the following assets by using keys protected by hardware security modules:
49+
Certificates are more secure, therefore use them, if possible. Unlike client secrets, client certificates can't be embedded in code, accidentally. When possible, use Azure Key Vault for certificate and secrets management to encrypt the following assets with keys protected by hardware security modules:
5150

52-
* authentication keys
51+
* Authentication keys
5352

54-
* storage account keys
53+
* Storage account keys
5554

56-
* data encryption keys
55+
* Data encryption keys
5756

5857
* .pfx files
5958

60-
* passwords
59+
* Passwords
6160

6261
For more information on Azure Key Vault and how to use it for certificate and secret management, see
6362
[About Azure Key Vault](../../key-vault/general/overview.md) and [Assign a Key Vault access policy using the Azure portal](../../key-vault/general/assign-access-policy-portal.md).
6463

6564
### Challenges and mitigations
66-
The following table presents mitigations to challenges you may encounter when using service principals.
67-
65+
66+
Use the following table to match challenges and mitigations, when using service principals.
6867

6968
| Challenges​| Mitigations​ |
7069
| - | - |
71-
| Access reviews for service principals assigned to privileged roles.| This functionality is in preview, and not yet widely available. |
72-
| Reviews service principals’ access| Manual check of resource’s access control list using the Azure portal. |
73-
| Over permissioned service principals| When you create automation service accounts or or service principals, provide only the permissions that are required for the task. Evaluate existing service principals to see if you can reduce privileges. |
74-
|Identify modifications to service principals' credentials or authentication methods |Use the Sensitive Operations Report workbook, which can help mitigate this issue. [See the explanation in this blog post](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/azure-ad-workbook-to-help-you-assess-solorigate-risk/ba-p/2010718).|
70+
| Access reviews for service principals assigned to privileged roles| This functionality is in preview, and not widely available |
71+
| Reviews service principal access| Manual check of resource access control list using the Azure portal |
72+
| Over-permissioned service principals| When you create automation service accounts or or service principals, provide permissions required for the task. Evaluate service principals to reduce privileges |
73+
|Identify modifications to service principal credentials or authentication methods |Use the Sensitive Operations Report workbook to mitigate. See also the Tech Community blog post [Azure AD workbook to help you assess Solorigate risk](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/azure-ad-workbook-to-help-you-assess-solorigate-risk/ba-p/2010718).|
7574

7675
## Find accounts using service principals
77-
Run the following commands to find accounts using service principals.
7876

79-
Using Azure CLI
77+
Run the following commands to find accounts using service principals with Azure CLI or PowerShell.
8078

79+
Azure CLI:
8180

8281
`az ad sp list`
8382

84-
Using PowerShell
83+
PowerShell:
8584

8685
`Get-AzureADServicePrincipal -All:$true`
8786

88-
89-
For more information see [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal)
87+
For more information see [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal).
9088

9189
## Assess service principal security
9290

@@ -96,26 +94,27 @@ Mitigate potential challenges using the following information.
9694

9795
|Challenges | Mitigations|
9896
| - | - |
99-
| Detect the user that consented to a multi-tenant app, and detect illicit consent grants to a multi-tenant app | Run the following PowerShell to find multi-tenant apps.<br>`Get-AzureADServicePrincipal -All:$true ? {$_.Tags -eq WindowsAzureActiveDirectoryIntegratedApp"}`<br>Disable user consent. <br>Allow user consent from verified publishers, for selected permissions (recommended) <br> Configure them under the user context, and their tokens should be used to trigger the service principal.|
100-
|Use of a hard-coded shared secret in a script using a service principal.|Use a certificate or Azure Key Vault​.|
101-
|Tracking who is using the certificate or the secret​| Monitor the service principal's sign-ins using the Azure AD sign-in logs.|
102-
Can't manage service principals' sign-in with Conditional Access.| Monitor the sign-ins using the Azure AD sign-in logs
103-
| The default Azure RBAC role is Contributor​. |Evaluate the needs and apply the role with the least possible permissions to meet that need.|
97+
| Detect the user who consented to a multi-tenant app, and detect illicit consent grants to a multi-tenant app | Run the following PowerShell to find multi-tenant apps.<br>`Get-AzureADServicePrincipal -All:$true ? {$_.Tags -eq WindowsAzureActiveDirectoryIntegratedApp"}`<br>Disable user consent. <br>Allow user consent from verified publishers, for selected permissions (recommended) <br> Configure them in the user context. Use their tokens to trigger the service principal.|
98+
|Use of a hard-coded shared secret in a script using a service principal|Use a certificate|
99+
|Tracking who uses the certificate or the secret​| Monitor the service principal sign-ins using the Azure AD sign-in logs|
100+
Can't manage service principal sign-in with Conditional Access| Monitor the sign-ins using the Azure AD sign-in logs
101+
| Contributor is the default Azure role-based access control (RBAC) role|Evaluate needs and apply the role with the least possible permissions|
104102

105103
## Move from a user account to a service principal​
106-
‎If you are using an Azure user account as a service principal, evaluate if you can move to a [Managed Identity](../../app-service/overview-managed-identity.md?tabs=dotnet) or a service principal. If you cannot use a managed identity, provision a service principal that has just enough permissions and scope to run the required tasks. You can create a service principal by [registering an application](../develop/howto-create-service-principal-portal.md), or with [PowerShell](../develop/howto-authenticate-service-principal-powershell.md).
107104

108-
When using Microsoft Graph, check the documentation of the specific API, [like in this example](/powershell/azure/create-azure-service-principal-azureps), ‎and make sure the permission type for application is showing as supported.
105+
If you're using an Azure user account as a service principal, evaluate if you can move to a [Managed Identity](../../app-service/overview-managed-identity.md?tabs=dotnet) or a service principal. If you can't use a managed identity, provision a service principal with enough permissions and scope to run the required tasks. You can create a service principal by [registering an application](../develop/howto-create-service-principal-portal.md), or with [PowerShell](../develop/howto-authenticate-service-principal-powershell.md).
106+
107+
When using Microsoft Graph, check the API documentation. See, [Create an Azure service principal](/powershell/azure/create-azure-service-principal-azureps). Ensure the permission type for application is supported.
109108

110109
## Next steps
111110

112-
**To learn more about service principals:**
111+
Learn more about service principals:
113112

114113
[Create a service principal](../develop/howto-create-service-principal-portal.md)
115114

116-
[Monitor service principal sign-ins](../reports-monitoring/concept-sign-ins.md)
115+
[Monitor service principal sign-ins](../reports-monitoring/concept-sign-ins.md)
117116

118-
**To learn more about securing service accounts:**
117+
Learn more about securing service accounts:
119118

120119
[Introduction to Azure service accounts](service-accounts-introduction-azure.md)
121120

@@ -124,3 +123,8 @@ When using Microsoft Graph, check the documentation of the specific API, [like i
124123
[Governing Azure service accounts](service-accounts-governing-azure.md)
125124

126125
[Introduction to on-premises service accounts](service-accounts-on-premises.md)
126+
127+
Conditional Access:
128+
129+
Use Conditional Access to block service principals from untrusted locations. See, [Create a location-based Conditional Access policy](/azure/active-directory/conditional-access/workload-identity#create-a-location-based-conditional-access-policy).
130+

0 commit comments

Comments
 (0)