Skip to content

Commit 04298d6

Browse files
committed
more edits, Acrolinx fixes
1 parent 68adfcd commit 04298d6

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

articles/spring-apps/tutorial-managed-identities-functions.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ ms.date: 07/10/2020
1414
> [!NOTE]
1515
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
1616
17-
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
17+
**This article applies to:** ✔️ Basic/Standard ✔️ Enterprise
1818

1919
This article shows you how to create a managed identity for an Azure Spring Apps app and use it to invoke HTTP triggered Functions.
2020

21-
Both Azure Functions and App Services have built in support for Azure Active Directory (Azure AD) authentication. By leveraging this built-in authentication capability along with Managed Identities for Azure Spring Apps, we can invoke RESTful services using modern OAuth semantics. This method doesn't require storing secrets in code and provides more granular controls for controlling access to external resources.
21+
Both Azure Functions and App Services have built in support for Azure Active Directory (Azure AD) authentication. By using this built-in authentication capability along with Managed Identities for Azure Spring Apps, we can invoke RESTful services using modern OAuth semantics. This method doesn't require storing secrets in code and provides more granular controls for controlling access to external resources.
2222

2323
## Prerequisites
2424

2525
* [Sign up for an Azure subscription](https://azure.microsoft.com/free/)
2626
* [Install the Azure CLI version 2.45.0 or higher](/cli/azure/install-azure-cli)
27-
* [Install Maven 3.0 or above](https://maven.apache.org/download.cgi)
27+
* [Install Maven 3.0 or higher](https://maven.apache.org/download.cgi)
2828
* [Install the Azure Functions Core Tools version 3.0.2009 or higher](../azure-functions/functions-run-local.md#install-the-azure-functions-core-tools)
2929

3030
## Create a resource group
@@ -43,28 +43,39 @@ To create a Function app you must first create a backing storage account, use th
4343
> Each Function app and Storage Account must have a unique name. Replace *\<your-functionapp-name>* with the name of your Function app and *\<your-storageaccount-name>* with the name of your Storage Account in the following examples.
4444
4545
```azurecli
46-
az storage account create --name <your-storageaccount-name> --resource-group myResourceGroup --location eastus --sku Standard_LRS
46+
az storage account create \
47+
--resource-group myResourceGroup \
48+
--name <your-storageaccount-name> \
49+
--location eastus \
50+
--sku Standard_LRS
4751
```
4852

4953
After the Storage Account is created, you can create the Function app.
5054

5155
```azurecli
52-
az functionapp create --name <your-functionapp-name> --resource-group myResourceGroup --consumption-plan-location eastus --os-type windows --runtime node --storage-account <your-storageaccount-name> --functions-version 3
56+
az functionapp create \
57+
--resource-group myResourceGroup \
58+
--name <your-functionapp-name> \
59+
--consumption-plan-location eastus \
60+
--os-type windows \
61+
--runtime node \
62+
--storage-account <your-storageaccount-name> \
63+
--functions-version 3
5364
```
5465

55-
Make a note of the returned **hostNames**, which is in the format *https://\<your-functionapp-name>.azurewebsites.net*. You use this value in a following step.
66+
Make a note of the returned `hostNames` value, which is in the format *https://\<your-functionapp-name>.azurewebsites.net*. You use this value in a following step.
5667

5768
## Enable Azure Active Directory Authentication
5869

59-
Access the newly created Function app from the [Azure portal](https://portal.azure.com) and select "Authentication / Authorization" from the settings menu. Enable App Service Authentication and set the "Action to take when request is not authenticated" to "Log in with Azure Active Directory". This setting ensures that all unauthenticated requests are denied (401 response).
70+
Access the newly created Function app from the [Azure portal](https://portal.azure.com) and select **Authentication / Authorization** from the settings menu. Enable App Service Authentication and set the **Action to take when request is not authenticated** to **Log in with Azure Active Directory**. This setting ensures that all unauthenticated requests are denied (401 response).
6071

6172
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-1.jpg" alt-text="Screenshot of the Azure portal showing Authentication / Authorization page with Azure Active Directory set as the default provider." lightbox="media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-1.jpg":::
6273

6374
Under **Authentication Providers**, select **Azure Active Directory** to configure the application registration. Selecting **Express Management Mode** automatically creates an application registration in your Azure AD tenant with the correct configuration.
6475

6576
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-2.jpg" alt-text="Screenshot of the Azure portal showing the Azure Active Directory provider set to Express Management Mode." lightbox="media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-2.jpg":::
6677

67-
After you save the settings, the function app restarts and all subsequent requests are prompted to log in via Azure AD. You can test that unauthenticated requests are now being rejected by navigating to the function apps root URL (returned in the **hostNames** output in the step above). You should be redirected to your organizations Azure AD login screen.
78+
After you save the settings, the function app restarts and all subsequent requests are prompted to log in via Azure AD. You can test that unauthenticated requests are now being rejected by navigating to the function apps root URL (returned in the `hostNames` output in a previous step). You should be redirected to your organizations Azure AD login screen.
6879

6980
## Create an HTTP Triggered Function
7081

@@ -111,13 +122,21 @@ After installing the spring extension, create an Azure Spring Apps instance with
111122

112123
```azurecli
113124
az extension add --upgrade --name spring
114-
az spring create --name mymsispringcloud --resource-group myResourceGroup --location eastus
125+
az spring create \
126+
--resource-group myResourceGroup \
127+
--name mymsispringcloud \
128+
--location eastus
115129
```
116130

117131
The following example creates an app named `msiapp` with a system-assigned managed identity, as requested by the `--assign-identity` parameter.
118132

119133
```azurecli
120-
az spring app create --name "msiapp" --service "mymsispringcloud" --resource-group "myResourceGroup" --assign-endpoint true --assign-identity
134+
az spring app create \
135+
--resource-group "myResourceGroup" \
136+
--service "mymsispringcloud" \
137+
--name "msiapp" \
138+
--assign-endpoint true \
139+
--assign-identity
121140
```
122141

123142
## Build sample Spring Boot app to invoke the Function
@@ -150,10 +169,14 @@ This sample invokes the HTTP triggered function by first requesting an access to
150169
mvn clean package
151170
```
152171

153-
1. Now deploy the app to Azure with the Azure CLI command `az spring app deploy`.
172+
1. Now deploy the app to Azure with the Azure CLI command `az spring app deploy`.
154173

155174
```azurecli
156-
az spring app deploy --name "msiapp" --service "mymsispringcloud" --resource-group "myResourceGroup" --jar-path target/sc-managed-identity-function-sample-0.1.0.jar
175+
az spring app deploy \
176+
--resource-group "myResourceGroup" \
177+
--service "mymsispringcloud" \
178+
--name "msiapp" \
179+
--jar-path target/sc-managed-identity-function-sample-0.1.0.jar
157180
```
158181

159182
1. Access the public endpoint or test endpoint to test your app.

0 commit comments

Comments
 (0)