Skip to content

Commit 68adfcd

Browse files
committed
edits, fix for MicrosoftDocs/azure-docs#108101
1 parent 2d762b0 commit 68adfcd

File tree

1 file changed

+43
-45
lines changed

1 file changed

+43
-45
lines changed

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

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.date: 07/10/2020
1616
1717
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
1818

19-
This article shows you how to create a managed identity for an Azure Spring Apps app and use it to invoke Http triggered Functions.
19+
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

2121
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.
2222

@@ -39,43 +39,43 @@ az group create --name myResourceGroup --location eastus
3939

4040
To create a Function app you must first create a backing storage account, use the command [az storage account create](/cli/azure/storage/account#az-storage-account-create):
4141

42-
> [!Important]
42+
> [!IMPORTANT]
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
4646
az storage account create --name <your-storageaccount-name> --resource-group myResourceGroup --location eastus --sku Standard_LRS
4747
```
4848

49-
Once the Storage Account has been created, you can create the Function app.
49+
After the Storage Account is created, you can create the Function app.
5050

5151
```azurecli
5252
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
5353
```
5454

55-
Make a note of the returned **hostNames**, which will be in the format *https://\<your-functionapp-name>.azurewebsites.net*. It will be used in a following step.
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.
5656

5757
## Enable Azure Active Directory Authentication
5858

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 will ensure that all unauthenticated requests are denied (401 response).
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).
6060

61-
![Authentication settings showing Azure Active Directory as the default provider](media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-1.jpg)
61+
:::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":::
6262

63-
Under Authentication Providers, select Azure Active Directory to configure the application registration. Selecting Express Management Mode will automatically create an application registration in your Azure AD tenant with the correct configuration.
63+
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.
6464

65-
![Azure Active Directory provider set to Express Management Mode](media/spring-cloud-tutorial-managed-identities-functions/function-auth-config-2.jpg)
65+
:::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":::
6666

67-
Once you save the settings, the function app will restart and all subsequent requests will be 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.
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.
6868

69-
## Create an Http Triggered Function
69+
## Create an HTTP Triggered Function
7070

71-
In an empty local directory, create a new function app and add an Http triggered function.
71+
In an empty local directory, create a new function app and add an HTTP triggered function.
7272

7373
```console
7474
func init --worker-runtime node
7575
func new --template HttpTrigger --name HttpTrigger
7676
```
7777

78-
By default Functions use key-based authentication to secure Http endpoints. Since we'll be enabling Azure AD authentication to secure access to the Functions, we want to [set the function auth level to anonymous](../azure-functions/functions-bindings-http-webhook-trigger.md#secure-an-http-endpoint-in-production) in the *function.json* file.
78+
By default, Functions use key-based authentication to secure HTTP endpoints. Since we're enabling Azure AD authentication to secure access to the Functions, we want to [set the function auth level to anonymous](../azure-functions/functions-bindings-http-webhook-trigger.md#secure-an-http-endpoint-in-production) in the *function.json* file.
7979

8080
```json
8181
{
@@ -89,7 +89,7 @@ By default Functions use key-based authentication to secure Http endpoints. Sinc
8989
}
9090
```
9191

92-
The app can now be published to the [Function app](#create-a-function-app) instance created in the previous step.
92+
You can now publish the app to the [Function app](#create-a-function-app) instance created in the previous step.
9393

9494
```console
9595
func azure functionapp publish <your-functionapp-name>
@@ -122,53 +122,51 @@ az spring app create --name "msiapp" --service "mymsispringcloud" --resource-gro
122122

123123
## Build sample Spring Boot app to invoke the Function
124124

125-
This sample will invoke the Http triggered function by first requesting an access token from the [MSI endpoint](../active-directory/managed-identities-azure-resources/how-to-use-vm-token.md#get-a-token-using-http) and using that token to authenticate the Function http request.
125+
This sample invokes the HTTP triggered function by first requesting an access token from the [MSI endpoint](../active-directory/managed-identities-azure-resources/how-to-use-vm-token.md#get-a-token-using-http) and using that token to authenticate the Function http request.
126126

127127
1. Clone the sample project.
128128

129-
```bash
130-
git clone https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples.git
131-
```
129+
```bash
130+
git clone https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples.git
131+
```
132132

133-
2. Specify your function URI and the trigger name in your app properties.
133+
1. Specify your function URI and the trigger name in your app properties.
134134

135-
```bash
136-
cd Azure-Spring-Cloud-Samples/managed-identity-function
137-
vim src/main/resources/application.properties
138-
```
135+
```bash
136+
cd Azure-Spring-Cloud-Samples/managed-identity-function
137+
vim src/main/resources/application.properties
138+
```
139139

140-
To use managed identity for Azure Spring Apps apps, add properties with the following content to *src/main/resources/application.properties*.
140+
To use managed identity for Azure Spring Apps apps, add properties with the following content to *src/main/resources/application.properties*.
141141

142-
```properties
143-
azure.function.uri=https://<your-functionapp-name>.azurewebsites.net
144-
azure.function.triggerPath=httptrigger
145-
```
142+
```properties
143+
azure.function.uri=https://<your-functionapp-name>.azurewebsites.net
144+
azure.function.triggerPath=httptrigger
145+
```
146146

147-
3. Package your sample app.
147+
1. Package your sample app.
148148

149-
```bash
150-
mvn clean package
151-
```
149+
```bash
150+
mvn clean package
151+
```
152152

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

155-
```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
157-
```
155+
```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
157+
```
158158

159-
5. Access the public endpoint or test endpoint to test your app.
159+
1. Access the public endpoint or test endpoint to test your app.
160160

161-
```bash
162-
curl https://mymsispringcloud-msiapp.azuremicroservices.io/func/springcloud
163-
```
161+
```bash
162+
curl https://mymsispringcloud-msiapp.azuremicroservices.io/func/springcloud
163+
```
164164

165-
You'll see the following message returned in the response body.
165+
You see the following message returned in the response body.
166166

167-
```output
168-
Function Response: Hello, springcloud. This HTTP triggered function executed successfully.
169-
```
170-
171-
You can try passing different values to the function by changing the path parameter.
167+
```output
168+
Function Response: Hello, springcloud. This HTTP triggered function executed successfully.
169+
```
172170

173171
## Next steps
174172

0 commit comments

Comments
 (0)