Create an App Service app on Azure Arc (Preview)
In this quickstart, you create an App Service app to an Azure Arc-enabled Kubernetes cluster (Preview). This scenario supports Linux apps only, and you can use a built-in language stack or a custom container.
Add Azure CLI extensions
Launch the Bash environment in Azure Cloud Shell.
Because these CLI commands are not yet part of the core CLI set, add them with the following commands:
az extension add --upgrade --yes --name customlocation az extension remove --name appservice-kube az extension add --upgrade --yes --name appservice-kube
1. Create a resource group
Run the following command.
az group create --name myResourceGroup --location eastus
2. Get the custom location
Get the following information about the custom location from your cluster administrator (see Create a custom location).
Get the custom location ID for the next step.
customLocationId=$(az customlocation show \ --resource-group $customLocationGroup \ --name $customLocationName \ --query id \ --output tsv)
3. Create an app
The following example creates a Node.js app. Replace
<app-name> with a name that's unique within your cluster (valid characters are
-). To see all supported runtimes, run
az webapp list-runtimes --linux.
az webapp create \ --resource-group myResourceGroup \ --name <app-name> \ --custom-location $customLocationId \ --runtime 'NODE|12-lts'
4. Deploy some code
az webapp up is not supported during the public preview.
Get a sample Node.js app using Git and deploy it using ZIP deploy. Replace
<app-name> with your web app name.
git clone https://github.com/Azure-Samples/nodejs-docs-hello-world cd nodejs-docs-hello-world zip -r package.zip . az webapp deployment source config-zip --resource-group myResourceGroup --name <app-name> --src package.zip
5. Get diagnostic logs using Log Analytics
To use Log Analytics, you should've previously enabled it when installing the App Service extension. If you installed the extension without Log Analytics, skip this step.
Navigate to the Log Analytics workspace that's configured with your App Service extension, then click Logs in the left navigation. Run the following sample query to show logs over the past 72 hours. Replace
<app-name> with your web app name. If there's an error when running a query, try again in 10-15 minutes (there may be a delay for Log Analytics to start receiving logs from your application).
let StartTime = ago(72h); let EndTime = now(); AppServiceConsoleLogs_CL | where TimeGenerated between (StartTime .. EndTime) | where AppName_s =~ "<app-name>"
The application logs for all the apps hosted in your Kubernetes cluster are logged to the Log Analytics workspace in the custom log table named
Log_s contains application logs for a given App Service and AppName_s contains the App Service app name. In addition to logs you write via your application code, the Log_s column also contains logs on container startup, shutdown, and Function Apps.
You can learn more about log queries in getting started with Kusto.
(Optional) Deploy a custom container
To create a custom container app, run az webapp create with
--deployment-container-image-name. For a private repository, add
For example, try:
az webapp create \ --resource-group myResourceGroup \ --name <app-name> \ --custom-location $customLocationId \ --deployment-container-image-name mcr.microsoft.com/appsvc/node:12-lts
To update the image after the app is create, see Change the Docker image of a custom container