Skip to content

Commit efeeb24

Browse files
Merge pull request #192749 from jiec-msft/mason/app_msi
[Spring-cloud] App managed identities
2 parents b7dc006 + 8cf1242 commit efeeb24

File tree

7 files changed

+309
-141
lines changed

7 files changed

+309
-141
lines changed

articles/spring-cloud/how-to-enable-system-assigned-managed-identity.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: karlerickson
66
ms.author: xiading
77
ms.service: spring-cloud
88
ms.topic: how-to
9-
ms.date: 02/09/2022
9+
ms.date: 04/15/2022
1010
ms.custom: devx-track-java, devx-track-azurecli
1111
zone_pivot_groups: spring-cloud-tier-selection
1212
---
@@ -26,22 +26,24 @@ If you're unfamiliar with managed identities for Azure resources, see the [Manag
2626
::: zone pivot="sc-enterprise-tier"
2727

2828
- An already provisioned Azure Spring Cloud Enterprise tier instance. For more information, see [Quickstart: Provision an Azure Spring Cloud service instance using the Enterprise tier](quickstart-provision-service-instance-enterprise.md).
29-
- [Azure CLI version 2.0.67 or later](/cli/azure/install-azure-cli).
30-
- [!INCLUDE [install-enterprise-extension](includes/install-enterprise-extension.md)]
29+
- [Azure CLI version 2.30.0 or higher](/cli/azure/install-azure-cli).
30+
- [!INCLUDE [install-app-user-identity-extension](includes/install-app-user-identity-extension.md)]
3131

3232
::: zone-end
3333

3434
::: zone pivot="sc-standard-tier"
3535

3636
- An already provisioned Azure Spring Cloud instance. For more information, see [Quickstart: Deploy your first application to Azure Spring Cloud](./quickstart.md).
37+
- [Azure CLI version 2.30.0 or higher](/cli/azure/install-azure-cli).
38+
- [!INCLUDE [install-app-user-identity-extension](includes/install-app-user-identity-extension.md)]
3739

3840
::: zone-end
3941

4042
## Add a system-assigned identity
4143

4244
Creating an app with a system-assigned identity requires setting an additional property on the application.
4345

44-
# [Portal](#tab/azure-portal)
46+
### [Portal](#tab/azure-portal)
4547

4648
To set up a managed identity in the portal, first create an app, and then enable the feature.
4749

@@ -50,13 +52,13 @@ To set up a managed identity in the portal, first create an app, and then enable
5052
3. Select **Identity**.
5153
4. Within the **System assigned** tab, switch **Status** to *On*. Select **Save**.
5254

53-
![Managed identity in portal](./media/enterprise/msi/msi-enable.png)
55+
:::image type="content" source="media/enterprise/msi/msi-enable.png" alt-text="Azure portal screenshot showing the Identity screen for an application." lightbox="media/enterprise/msi/msi-enable.png":::
5456

55-
# [Azure CLI](#tab/azure-cli)
57+
### [Azure CLI](#tab/azure-cli)
5658

5759
You can enable system-assigned managed identity during app creation or on an existing app.
5860

59-
**Enable system-assigned managed identity during creation of an app**
61+
### Enable system-assigned managed identity during creation of an app
6062

6163
The following example creates an app named *app_name* with a system-assigned managed identity, as requested by the `--assign-identity` parameter.
6264

@@ -65,18 +67,19 @@ az spring-cloud app create \
6567
--resource-group <resource-group-name> \
6668
--name <app-name> \
6769
--service <service-instance-name> \
68-
--assign-identity
70+
--system-assigned
6971
```
7072

71-
**Enable system-assigned managed identity on an existing app**
73+
### Enable system-assigned managed identity on an existing app**
7274

7375
Use `az spring-cloud app identity assign` command to enable the system-assigned identity on an existing app.
7476

7577
```azurecli
7678
az spring-cloud app identity assign \
7779
--resource-group <resource-group-name> \
7880
--name <app-name> \
79-
--service <service-instance-name>
81+
--service <service-instance-name> \
82+
--system-assigned
8083
```
8184

8285
---
@@ -93,25 +96,34 @@ Azure Spring Cloud shares the same endpoint for token acquisition with Azure Vir
9396

9497
Removing a system-assigned identity will also delete it from Azure AD. Deleting the app resource automatically removes system-assigned identities from Azure AD.
9598

96-
# [Portal](#tab/azure-portal)
99+
### [Portal](#tab/azure-portal)
97100

98101
To remove system-assigned managed identity from an app that no longer needs it:
99102

100103
1. Sign in to the portal using an account associated with the Azure subscription that contains the Azure Spring Cloud instance.
101104
1. Navigate to the desired application and select **Identity**.
102105
1. Under **System assigned**/**Status**, select **Off** and then select **Save**:
103106

104-
![Managed identity](./media/enterprise/msi/msi-disable.png)
107+
:::image type="content" source="media/enterprise/msi/msi-disable.png" alt-text="Azure portal screenshot showing the Identity screen for an application, with the Status switch set to Off." lightbox="media/enterprise/msi/msi-disable.png":::
105108

106-
# [Azure CLI](#tab/azure-cli)
109+
### [Azure CLI](#tab/azure-cli)
107110

108111
To remove system-assigned managed identity from an app that no longer needs it, use the following command:
109112

110113
```azurecli
111114
az spring-cloud app identity remove \
112115
--resource-group <resource-group-name> \
113116
--name <app-name> \
114-
--service <service-instance-name>
117+
--service <service-instance-name> \
118+
--system-assigned
119+
```
120+
121+
## Get the client ID from the object ID (principal ID)
122+
123+
Use the following command to get the client ID from the object/principle ID value:
124+
125+
```azurecli
126+
az ad sp show --id <object-ID> --query appId
115127
```
116128

117129
---

articles/spring-cloud/how-to-manage-user-assigned-managed-identities.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ az spring-cloud app identity remove \
118118

119119
For user-assigned managed identity limitations, see [Quotas and service plans for Azure Spring Cloud](./quotas.md).
120120

121-
122121
## Next steps
123122

124-
* [Learn more about managed identities for Azure resources](../active-directory/managed-identities-azure-resources/overview.md)
125-
* [How to use managed identities with Java SDK](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples)
123+
- [Learn more about managed identities for Azure resources](../active-directory/managed-identities-azure-resources/overview.md)
124+
- [How to use managed identities with Java SDK](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Managed identities for applications in Azure Spring Cloud
3+
titleSuffix: Azure Spring Cloud Enterprise Tier
4+
description: Home page for managed identities for applications.
5+
author: karlerickson
6+
ms.author: jiec
7+
ms.service: spring-cloud
8+
ms.topic: how-to
9+
ms.date: 04/15/2022
10+
ms.custom: devx-track-java, devx-track-azurecli
11+
zone_pivot_groups: spring-cloud-tier-selection
12+
---
13+
14+
# Use managed identities for applications in Azure Spring Cloud
15+
16+
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
17+
18+
This article shows you how to use system-assigned and user-assigned managed identities for applications in Azure Spring Cloud.
19+
20+
Managed identities for Azure resources provide an automatically managed identity in Azure Active Directory (Azure AD) to an Azure resource such as your application in Azure Spring Cloud. You can use this identity to authenticate to any service that supports Azure AD authentication, without having credentials in your code.
21+
22+
## Feature status
23+
24+
| System-assigned | User-assigned |
25+
| - | - |
26+
| GA | Preview |
27+
28+
## Manage managed identity for an application
29+
30+
For system-assigned managed identities, see [How to enable and disable system-assigned managed identity](./how-to-enable-system-assigned-managed-identity.md).
31+
32+
For user-assigned managed identities, see [How to assign and remove user-assigned managed identities](./how-to-manage-user-assigned-managed-identities.md).
33+
34+
## Obtain tokens for Azure resources
35+
36+
An application can use its managed identity to get tokens to access other resources protected by Azure AD, such as Azure Key Vault. These tokens represent the application accessing the resource, not any specific user of the application.
37+
38+
You may need to configure the target resource to allow access from your application. For more information, see [Assign a managed identity access to a resource by using the Azure portal](../active-directory/managed-identities-azure-resources/howto-assign-access-portal.md). For example, if you request a token to access Key Vault, be sure you have added an access policy that includes your application's identity. Otherwise, your calls to Key Vault will be rejected, even if they include the token. To learn more about which resources support Azure Active Directory tokens, see [Azure services that support Azure AD authentication](../active-directory/managed-identities-azure-resources/services-azure-active-directory-support.md).
39+
40+
Azure Spring Cloud shares the same endpoint for token acquisition with Azure Virtual Machines. We recommend using Java SDK or Spring Boot starters to acquire a token. For various code and script examples and guidance on important topics such as handling token expiration and HTTP errors, see [How to use managed identities for Azure resources on an Azure VM to acquire an access token](../active-directory/managed-identities-azure-resources/how-to-use-vm-token.md).
41+
42+
## Examples of connecting Azure services in application code
43+
44+
The following table provides links to articles that contain examples:
45+
46+
| Azure service | tutorial |
47+
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------|
48+
| Key Vault | [Tutorial: Use a managed identity to connect Key Vault to an Azure Spring Cloud app](tutorial-managed-identities-key-vault.md) |
49+
| Azure Functions | [Tutorial: Use a managed identity to invoke Azure Functions from an Azure Spring Cloud app](tutorial-managed-identities-functions.md) |
50+
| Azure SQL | [Use a managed identity to connect Azure SQL Database to an Azure Spring Cloud app](connect-managed-identity-to-azure-sql.md) |
51+
52+
## Best practices when using managed identities
53+
54+
We highly recommend that you use system-assigned and user-assigned managed identities separately unless you have a valid use case. If you use both kinds of managed identity together, failure might happen if an application is using system-assigned managed identity and the application gets the token without specifying the client ID of that identity. This scenario may work fine until one or more user-assigned managed identities are assigned to that application, then the application may fail to get the correct token.
55+
56+
## Limitations
57+
58+
### Maximum number of user-assigned managed identities per application
59+
60+
For the maximum number of user-assigned managed identities per application, see [Quotas and Service Plans for Azure Spring Cloud](./quotas.md).
61+
62+
### Azure services that aren't supported
63+
64+
The following services do not currently support managed identity-based access:
65+
66+
- Azure Redis Cache
67+
- Azure Flexible MySQL
68+
- Azure Flexible PostgreSQL
69+
- Azure Database for MariaDB
70+
- Azure Cosmos DB - Mongo DB
71+
- Azure Cosmos DB - Cassandra
72+
- Azure Databricks
73+
74+
---
75+
76+
## Concept mapping
77+
78+
The following table shows the mappings between concepts in Managed Identity scope and Azure AD scope:
79+
80+
| Managed Identity scope | Azure AD scope |
81+
|------------------------|----------------|
82+
| Principal ID | Object ID |
83+
| Client ID | Application ID |
84+
85+
## Next steps
86+
87+
- [Access Azure Key Vault with managed identities in Spring boot starter](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-starter-keyvault-secrets/README.md#use-msi--managed-identities)
88+
- [Learn more about managed identities for Azure resources](https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/active-directory/managed-identities-azure-resources/overview.md)
89+
- [How to use managed identities with Java SDK](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples)
208 KB
Loading

articles/spring-cloud/quotas.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@ ms.author: karler
99
ms.custom: devx-track-java
1010
---
1111

12-
# Quotas and Service Plans for Azure Spring Cloud
12+
# Quotas and service plans for Azure Spring Cloud
1313

1414
**This article applies to:** ✔️ Java ✔️ C#
1515

1616
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
1717

18-
All Azure services set default limits and quotas for resources and features. Azure Spring Cloud offers two pricing tiers: Basic and Standard. We will detail limits for both tiers in this article.
18+
All Azure services set default limits and quotas for resources and features. Azure Spring Cloud offers two pricing tiers: Basic and Standard. We will detail limits for both tiers in this article.
1919

2020
## Azure Spring Cloud service tiers and limits
2121

22-
| Resource | Scope | Basic | Standard/Enterprise |
23-
|--------------------------------------|-----------------------------------------|--------------------|---------------------|
24-
| vCPU | per app instance | 1 | 4 |
25-
| Memory | per app instance | 2 GB | 8 GB |
26-
| Azure Spring Cloud service instances | per region per subscription | 10 | 10 |
27-
| Total app instances | per Azure Spring Cloud service instance | 25 | 500 |
28-
| Custom Domains | per Azure Spring Cloud service instance | 0 | 25 |
29-
| Persistent volumes | per Azure Spring Cloud service instance | 1 GB/app x 10 apps | 50 GB/app x 10 apps |
30-
| Inbound Public Endpoints | per Azure Spring Cloud service instance | 10 <sup>1</sup> | 10 <sup>1</sup> |
22+
| Resource | Scope | Basic | Standard/Enterprise |
23+
|--------------------------------------|-----------------------------------------|--------------------|-------------------------------------------------|
24+
| vCPU | per app instance | 1 | 4 |
25+
| Memory | per app instance | 2 GB | 8 GB |
26+
| Azure Spring Cloud service instances | per region per subscription | 10 | 10 |
27+
| Total app instances | per Azure Spring Cloud service instance | 25 | 500 |
28+
| Custom Domains | per Azure Spring Cloud service instance | 0 | 25 |
29+
| Persistent volumes | per Azure Spring Cloud service instance | 1 GB/app x 10 apps | 50 GB/app x 10 apps |
30+
| Inbound Public Endpoints | per Azure Spring Cloud service instance | 10 <sup>1</sup> | 10 <sup>1</sup> |
3131
| Outbound Public IPs | per Azure Spring Cloud service instance | 1 <sup>2</sup> | 2 <sup>2</sup> <br> 1 if using VNet<sup>2</sup> |
32-
| User-assigned managed identities | per app instance | 20 | 20 |
32+
| User-assigned managed identities | per app instance | 20 | 20 |
3333

3434
<sup>1</sup> You can increase this limit via support request to a maximum of 1 per app.
3535

articles/spring-cloud/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ items:
204204
href: troubleshooting-vnet.md
205205
- name: Secure
206206
items:
207+
- name: Use managed identities for applications in Azure Spring Cloud
208+
href: how-to-use-managed-identities.md
207209
- name: Enable system-assigned managed identity
208210
href: how-to-enable-system-assigned-managed-identity.md
209211
- name: Manage user-assigned managed identities

0 commit comments

Comments
 (0)