A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/azure/app-service/tutorial-custom-container-sidecar below:

Tutorial: Configure a sidecar for a custom container app - Azure App Service

This tutorial shows you how to add an OpenTelemetry collector as a sidecar container to a Linux custom container app in Azure App Service.

Sidecar containers in App Service let you deploy extra services and features to your Linux apps without tightly coupling them to the built-in or custom main container. The sidecar containers run alongside the main application container in the same App Service plan.

You can add up to nine sidecar containers for each Linux app in App Service. For example, you can add monitoring, logging, configuration, and networking services as sidecar containers. An OpenTelemetry collector sidecar is one example for monitoring.

For bring-your-own-code Linux apps, see Tutorial: Configure a sidecar container for a Linux app in Azure App Service.

Prerequisites 1. Set up the tutorial resources

To clone the sample repository and create the resources for this tutorial, run the following commands in Cloud Shell. When prompted, select the Azure subscription and Azure region you want to use.

git clone https://github.com/Azure-Samples/app-service-sidecar-tutorial-prereqs
cd app-service-sidecar-tutorial-prereqs
azd env new my-sidecar-env
azd provision

The azd provision command uses the included templates to create an Azure resource group called my-sidecar-env_group that contains the following Azure resources:

When deployment completes, you should see output similar to the following example:

Success!

APPLICATIONINSIGHTS_CONNECTION_STRING = InstrumentationKey=aaaaaaaa-0b0b-1c1c-2d2d-333333333333;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=00001111-aaaa-2222-bbbb-3333cccc4444
Azure container registry name = acro2lc774l6vjgg
Managed identity resource ID = /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/my-sidecar-env_group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-my-sidecar-env_group
Managed identity client ID = 00aa00aa-bb11-cc22-dd33-44ee44ee44ee

Open resource group in the portal: https://portal.azure.com/#@/resource/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/my-sidecar-env_group

Copy and save the value for APPLICATIONINSIGHTS_CONNECTION_STRING to use later in this tutorial.

Select the link for Open resource group in the portal to open the provisioned resource group in the Azure portal.

2. Create a sidecar-enabled app

In the resource group in the Azure portal, create a Linux custom container app with sidecar support, and configure the main container.

  1. On the resource group's page in the Azure portal, select Create.

  2. On the Marketplace page, search for web app, select the down arrow next to Create on the Web App tile, and select Web App.

  3. On the Basics tab of the Create Web App page, provide the following information:

  4. Leave the rest of the settings as they are, and select the Container tab at the top of the page.

  5. On the Container tab, provide the following information:

  6. Select Review + create, and when validation passes, select Create.

  7. Once the deployment completes, select Go to resource.

  8. On your app's page, open the URL next to Default domain, https://<app-name>.azurewebsites.net, in a new browser tab to see the default nginx page.

3. Add a sidecar container to the app

Add a sidecar container to your Linux custom container app.

  1. On the app's page in the Azure portal, select Deployment Center under Deployment in the left navigation menu. The Deployment Center page shows all the containers in the app, currently only the main container.

  2. Select Add > Custom container.

  3. On the Add container pane, complete the following information:

  4. Select Apply.

There are now two containers in the deployment center labeled Main and Sidecar. An app must have one main container and can have multiple sidecar containers.

4. Configure environment variables

In the sample scenario, the otel-collector sidecar is configured to export the OpenTelemetry data to Azure Monitor using the connection string as an environment variable. For more information, see the OpenTelemetry configuration file for the otel-collector image.

Configure the environment variable for the container by configuring app settings for the app. App settings are accessible to all the containers in the app.

  1. On the app's page in the Azure portal, select Environment variables under Settings in the left navigation menu.

  2. On the App settings tab of the Environment variables page, select Add.

  3. On the Add/Edit application setting pane, enter the following values:

  4. Select Apply, then select Apply again, and then select Confirm. The APPLICATIONINSIGHTS_CONNECTION_STRING app setting now appears on the App settings tab.

5. Verify in Application Insights

The otel-collector sidecar should now export data to Application Insights.

  1. Go to your app in a new browser tab and refresh the page a few times to generate some web requests.

  2. On the resource group page in the Azure portal, select the Application Insights resource. You should now see some data in the default charts on the Application Insights Overview page.

Note

In this common monitoring scenario, Application Insights is just one of the OpenTelemetry targets you can use, such as Jaeger, Prometheus, and Zipkin.

6. Clean up resources

When you no longer need the environment you created for this tutorial, you can delete the resource group, which removes the app service and all related resources. Run the following command in the cloned repository in Cloud Shell.

azd down

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4