Skip to content

Commit e95734e

Browse files
committed
changes from troubleshooting
1 parent c17d277 commit e95734e

File tree

2 files changed

+31
-42
lines changed

2 files changed

+31
-42
lines changed

articles/app-service/tutorial-custom-container-sidecar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: 'Tutorial: Configure a sidecar for a custom container app'
33
description: Add sidecar containers to your custom container in Azure App Service. Add or update services to your application without changing your application container.
44
ms.topic: tutorial
55
ms.date: 04/07/2024
6-
ms.author: msangapu
7-
author: msangapu-msft
6+
ms.author: cephalin
7+
author: cephalin
88
keywords: azure app service, web app, linux, windows, docker, container, sidecar
99
---
1010

articles/app-service/tutorial-sidecar.md

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: 'Tutorial: Configure a sidecar container'
33
description: Add sidecar containers to your Linux app in Azure App Service. Add or update services to your application without changing your application code.
44
ms.topic: tutorial
55
ms.date: 11/19/2024
6-
ms.author: msangapu
7-
author: msangapu-msft
6+
ms.author: cephalin
7+
author: cephalin
88
keywords: azure app service, web app, linux, windows, docker, sidecar
99
---
1010

@@ -25,12 +25,12 @@ For more information about side container in App Service, see:
2525

2626
First you create the resources that the tutorial uses. They're used for this particular scenario and aren't required for sidecar containers in general.
2727

28-
1. In the [Azure Cloud Shell](https://shell.azure.com), run the following commands:
28+
1. In the [Azure Cloud Shell](https://shell.azure.com), run the following commands. Be sure to supply the `<environment-name>`
2929

3030
```azurecli-interactive
3131
git clone https://github.com/Azure-Samples/app-service-sidecar-tutorial-prereqs
3232
cd app-service-sidecar-tutorial-prereqs
33-
azd env new my-sidecar-environment
33+
azd env new <environment-name>
3434
azd provision
3535
```
3636
@@ -43,16 +43,19 @@ First you create the resources that the tutorial uses. They're used for this par
4343
4444
<pre>
4545
APPLICATIONINSIGHTS_CONNECTION_STRING = <b>InstrumentationKey=...;IngestionEndpoint=...;LiveEndpoint=...</b>
46-
47-
Open resource group in the portal: <b>https://portal.azure.com/#@/resource/subscriptions/.../resourceGroups/my-sidecar-env_group</b>
46+
Azure container registry name = <b>&lt;registry-name&gt;</b>
47+
Managed identity resource ID = <b>&lt;managed-identity-resource-id&gt;</b>
48+
Managed identity client ID = <b>&lt;managed-identity-client-id&gt;</b>
49+
50+
Open resource group in the portal: <b>https://portal.azure.com/#@/resource/subscriptions/&lt;subscription-id&gt;/resourceGroups/&lt;group-name&gt;</b>
4851
</pre>
4952
50-
1. Open the resource group link in a browser tab. You'll need to use the connection string later.
53+
1. Open the resource group link in a browser tab. You'll need these output values later.
5154
5255
> [!NOTE]
5356
> `azd provision` uses the included templates to create the following Azure resources:
5457
>
55-
> - A resource group called *my-sidecar-env_group*.
58+
> - A resource group based on the environment name.
5659
> - A [container registry](/azure/container-registry/container-registry-intro) with two images deployed:
5760
> - An Nginx image with the OpenTelemetry module.
5861
> - An OpenTelemetry collector image, configured to export to [Azure Monitor](/azure/azure-monitor/overview).
@@ -70,7 +73,7 @@ cd MyFirstAzureWebApp
7073
az webapp up --name <app-name> --os-type linux
7174
```
7275

73-
This basic web application is deployed as MyFirstAzureWebApp.dll to App Service.
76+
After a few minutes, this basic web application is deployed as MyFirstAzureWebApp.dll to App Service.
7477

7578
## 3. Add a sidecar container
7679

@@ -88,6 +91,7 @@ In this section, you add a sidecar container to your Linux app. The portal exper
8891
1. Select **Add** and configure the new container as follows:
8992
- **Name**: *otel-collector*
9093
- **Image source**: **Azure Container Registry**
94+
- **Authentication**: **Admin Credentials**
9195
- **Registry**: The registry created by `azd provision`
9296
- **Image**: **otel-collector**
9397
- **Tag**: **latest**
@@ -98,42 +102,34 @@ In this section, you add a sidecar container to your Linux app. The portal exper
98102

99103
### [Use ARM template](#tab/template)
100104

105+
1. In the Cloud Shell, run the following command to add to the web app the user-assigned managed identity that `azd provision` created. This identity already has the permissions to pull from the container registry. Use the value of `<managed-identity-resource-id>` in the `azd provision` output.
106+
107+
```azurecli-interactive
108+
az webapp identity assign --identities <managed-identity-resource-id>
109+
```
110+
111+
If you run this command inside *~/MyFirstAzureWebApp*, you don't need to add any other parameters because `az webapp up` set defaults already for the resource group and the app name.
112+
101113
1. Navigate to the [custom deployment](https://portal.azure.com/#create/Microsoft.Template) template in the portal.
102114
103115
1. Select **Build your own template in the editor**.
104116
105-
1. Replace the content in the textbox with the following JSON code and select **Save**:
117+
1. Replace the content in the textbox with the following JSON code and select **Save**. For `<registry-name>` and `<managed-identity-client-id>`, use the output values from `azd provision` earlier. For `<app-name>`, use the app name in `az webapp up earlier`. For `<sidecar-name>`, supply a name for the sidecar container.
106118
107119
```json
108120
{
109121
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
110122
"contentVersion": "1.0.0.0",
111-
"parameters": {
112-
"appName": {
113-
"type": "String"
114-
},
115-
"sidecarName": {
116-
"defaultValue": "otel-collector",
117-
"type": "String"
118-
},
119-
"azureContainerRegistryName": {
120-
"type": "String"
121-
},
122-
"azureContainerRegistryImageName": {
123-
"defaultValue": "otel-collector:latest",
124-
"type": "String"
125-
}
126-
},
127123
"resources": [
128124
{
129125
"type": "Microsoft.Web/sites/sitecontainers",
130-
"apiVersion": "2023-12-01",
131-
"name": "[concat(parameters('appName'), '/', parameters('sidecarName'))]",
126+
"apiVersion": "2024-04-01",
127+
"name": "<app-name>/<sidecar-name>",
132128
"properties": {
133-
"image": "[concat(parameters('azureContainerRegistryName'), '.azurecr.io/', parameters('azureContainerRegistryImageName'))]",
129+
"image": "<registry-name>.azurecr.io/otel-collector:latest",
134130
"isMain": false,
135-
"authType": "UserCredentials",
136-
"userName": "[parameters('azureContainerRegistryName')]",
131+
"authType": "UserAssigned",
132+
"userManagedIdentityClientId": "<managed-identity-client-id>",
137133
"volumeMounts": [],
138134
"environmentVariables": []
139135
}
@@ -155,14 +151,7 @@ In this section, you add a sidecar container to your Linux app. The portal exper
155151
> }
156152
> ```
157153
158-
1. Configure the template input with the following information:
159-
160-
- **Resource Group**: Select the resource group with the App Service app you created with `az webapp up` earlier.
161-
- **App Name**: Type the name of the App Service app.
162-
- **Azure Container Registry Name**: Type the name of the registry you created with `azd up` earlier.
163-
- **Azure Container Registry Image Name**: Leave the default value of *otel-collector:latest*. This points to the OpenTelemtry image in the registry.
164-
165-
1. Select **Review + Create**, then select **Create**.
154+
1. For the template input, select the resource group that has the web app. Select **Review + Create**, then select **Create**.
166155
167156
Since the portal UI isn't available to you, you can't see this sidecar container as part of the app, but you should be able to [see related start-up logs for the sidecar](troubleshoot-diagnostic-logs.md).
168157
@@ -217,7 +206,7 @@ In this step, you create the autoinstrumentation for your app according to the s
217206
EOF
218207
```
219208
220-
1. Deploy this file to your app with the following Azure CLI command:
209+
1. Deploy this file to your app with the following Azure CLI command. If you're still in the `~/MyFirstAzureWebApp`, then no other parameters are necessary because the resource group and web app were saved as defaults by `az webapp up`.
221210
222211
```azurecli-interactive
223212
az webapp deploy --src-path startup.sh --target-path /home/site/startup.sh --type static

0 commit comments

Comments
 (0)