Skip to content

Commit c851301

Browse files
committed
other edits
1 parent 1abf0fc commit c851301

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

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

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@ Both Azure Functions and App Services have built in support for Azure Active Dir
2929

3030
## Create a resource group
3131

32-
A resource group is a logical container into which Azure resources are deployed and managed. Use the following command to create a resource group to contain a Function app. For more information, see [az group create](/cli/azure/group#az-group-create):
32+
A resource group is a logical container into which Azure resources are deployed and managed. Use the following command to create a resource group to contain a Function app. For more information, see the [az group create](/cli/azure/group#az-group-create) command.
3333

3434
```azurecli
3535
az group create --name <resource-group-name> --location <location>
3636
```
3737

38-
## Create a Function App
38+
## Create a Function app
3939

40-
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):
40+
To create a Function app, you must first create a backing storage account. You can use the [az storage account create](/cli/azure/storage/account#az-storage-account-create) command.
4141

4242
> [!IMPORTANT]
43-
> Each Function app and Storage Account must have a unique name. In the following command, replace *\<function-app-name>* with the name of your Function app and *\<storage-account-name>* with the name of your Storage Account.
43+
> Each Function app and storage account must have a unique name.
44+
45+
Use the following command to create the storage account. Replace *\<function-app-name>* with the name of your Function app and *\<storage-account-name>* with the name of your storage account.
4446

4547
```azurecli
4648
az storage account create \
@@ -50,7 +52,7 @@ az storage account create \
5052
--sku Standard_LRS
5153
```
5254

53-
After the Storage Account is created, use the following command to create the Function app.
55+
After the storage account is created, use the following command to create the Function app.
5456

5557
```azurecli
5658
az functionapp create \
@@ -63,37 +65,38 @@ az functionapp create \
6365
--functions-version 3
6466
```
6567

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.
68+
Make a note of the returned `hostNames` value, which is in the format *https://\<your-functionapp-name>.azurewebsites.net*. Use this value in the Function app's root URL for testing the Function app.
6769

6870
## Enable Azure Active Directory Authentication
6971

7072
Use the following steps to enable Azure Active Directory authentication to access your Function app.
7173

72-
1. In the Azure portal, navigate to your resource group and open the Function app you created.
74+
1. In the Azure portal, navigate to your resource group and then open the Function app you created.
7375
1. In the navigation pane, select **Authentication** and then select **Add identity provider** on the main pane.
7476
1. On the **Add an identity provider** page, select **Microsoft** from the **Identity provider** dropdown menu.
7577

7678
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/add-identity-provider.png" alt-text="Screenshot of the Azure portal showing the Add an identity provider page with Microsoft highlighted in the identity provider dropdown menu." lightbox="media/spring-cloud-tutorial-managed-identities-functions/add-identity-provider.png":::
7779

78-
1. On the **Basics** settings for the **Add an identity provider** page, set **Supported account type** to **Any Azure AD directory - Multi-tenant**.
79-
1. Set **Unauthorized requests** to **HTTP 401 Unauthorized: recommended for APIs**. This setting ensures that all unauthenticated requests are denied (401 response).
80+
1. Select **Add**.
81+
1. For the **Basics** settings on the **Add an identity provider** page, set **Supported account types** to **Any Azure AD directory - Multi-tenant**.
82+
1. Set **Unauthenticated requests** to **HTTP 401 Unauthorized: recommended for APIs**. This setting ensures that all unauthenticated requests are denied (401 response).
8083

81-
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png" alt-text="Screenshot of the Azure portal showing the settings page for adding an identity provider with the Any Azure AD directory Multi tenant option highlighted for the account type setting, and also showing the HTTP 401 Unauthorized recommended for APIs option highlighted for the Unauthenticated requests setting." lightbox="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png":::
84+
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png" alt-text="Screenshot of the Azure portal showing the settings page for adding an identity provider. This page highlights the 'supported account types' setting set to the 'Any Azure AD directory Multi tenant' option and also highlights the 'Unauthenticated requests' setting set to the 'HTTP 401 Unauthorized recommended for APIs' option." lightbox="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png":::
8285

8386
1. Select **Add**.
8487

85-
After you add the settings, the Function app restarts and all subsequent requests are prompted to sign in through Azure AD. You can test that unauthenticated requests are currently being rejected by navigating to the Function app's root URL (returned in the `hostNames` output in a previous step). You should be redirected to your organization's Azure Active Directory sign-in screen.
88+
After you add the settings, the Function app restarts and all subsequent requests are prompted to sign in through Azure AD. You can test that unauthenticated requests are currently being rejected with the Function app's root URL (returned in the `hostNames` output of the `az functionapp create` command). You should then be redirected to your organization's Azure Active Directory sign-in screen.
8689

8790
## Create an HTTP Triggered Function
8891

89-
In an empty local directory, create a new function app and add an HTTP triggered function.
92+
In an empty local directory, use the following commands to create a new function and add an HTTP triggered function.
9093

9194
```console
9295
func init --worker-runtime node
9396
func new --template HttpTrigger --name HttpTrigger
9497
```
9598

96-
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.
99+
By default, Functions use key-based authentication to secure HTTP endpoints. To enable Azure AD authentication to secure access to the Functions, set the `authLevel` key to `anonymous`in the *function.json* file.
97100

98101
```json
99102
{
@@ -107,7 +110,9 @@ By default, Functions use key-based authentication to secure HTTP endpoints. Sin
107110
}
108111
```
109112

110-
You can now publish the app to the [Function app](#create-a-function-app) instance created in the previous step.
113+
For more information, see the [Secure an HTTP endpoint in production](../azure-functions/functions-bindings-http-webhook-trigger.md#secure-an-http-endpoint-in-production) section of [Azure Functions HTTP trigger](../azure-functions/functions-bindings-http-webhook-trigger.md).
114+
115+
Use the following command to publish the app to the instance created in the previous step:
111116

112117
```console
113118
func azure functionapp publish <your-functionapp-name>
@@ -125,22 +130,22 @@ Functions in <your-functionapp-name>:
125130

126131
## Create Azure Spring Apps service and app
127132

128-
After installing the spring extension, create an Azure Spring Apps instance with the Azure CLI command `az spring create`.
133+
Use the following commands to add the spring extension and to create a new instance of Azure Spring Apps.
129134

130135
```azurecli
131136
az extension add --upgrade --name spring
132137
az spring create \
133-
--resource-group myResourceGroup \
134-
--name mymsispringcloud \
135-
--location eastus
138+
--resource-group <resource-group-name> \
139+
--name <Azure-Spring-Instance-name> \
140+
--location <location>
136141
```
137142

138-
The following example creates an app named `msiapp` with a system-assigned managed identity, as requested by the `--assign-identity` parameter.
143+
Use the following command to create an app named `msiapp` with a system-assigned managed identity, as requested by the `--assign-identity` parameter.
139144

140145
```azurecli
141146
az spring app create \
142-
--resource-group "myResourceGroup" \
143-
--service "mymsispringcloud" \
147+
--resource-group <resource-group-name> \
148+
--service <Azure-Spring-Apps-instance-name> \
144149
--name "msiapp" \
145150
--assign-endpoint true \
146151
--assign-identity
@@ -150,13 +155,13 @@ az spring app create \
150155

151156
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.
152157

153-
1. Clone the sample project.
158+
1. Use the following command clone the sample project.
154159

155160
```bash
156161
git clone https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples.git
157162
```
158163

159-
1. Specify your function URI and the trigger name in your app properties.
164+
1. Use the following command to specify your function URI and the trigger name in your app properties.
160165

161166
```bash
162167
cd Azure-Spring-Cloud-Samples/managed-identity-function
@@ -165,18 +170,18 @@ This sample invokes the HTTP triggered function by first requesting an access to
165170

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

168-
```properties
169-
azure.function.uri=https://<your-functionapp-name>.azurewebsites.net
173+
```text
174+
azure.function.uri=https://<function-app-name>.azurewebsites.net
170175
azure.function.triggerPath=httptrigger
171176
```
172177

173-
1. Package your sample app.
178+
1. Use the following command to package your sample app.
174179

175180
```bash
176181
mvn clean package
177182
```
178183

179-
1. Now deploy the app to Azure with the Azure CLI command `az spring app deploy`.
184+
1. Use the following command to deploy the app to Azure.
180185

181186
```azurecli
182187
az spring app deploy \
@@ -186,13 +191,13 @@ This sample invokes the HTTP triggered function by first requesting an access to
186191
--jar-path target/asc-managed-identity-function-sample-0.1.0.jar
187192
```
188193

189-
1. Access the public endpoint or test endpoint to test your app.
194+
1. Use the following command to access the public endpoint or test endpoint to test your app.
190195

191196
```bash
192197
curl https://mymsispringcloud-msiapp.azuremicroservices.io/func/springcloud
193198
```
194199

195-
You see the following message returned in the response body.
200+
The following message is returned in the response body.
196201

197202
```output
198203
Function Response: Hello, springcloud. This HTTP triggered function executed successfully.

0 commit comments

Comments
 (0)