Managing Azure App Service Environment (ASE) with Azure CLI
1. Scope of This Article
This article introduces specific commands and their usage to retrieve information related to ASE using Azure CLI.
2. Content
Retrieving Information About Azure App Service Environment (ASE)
To retrieve detailed information about a specific App Service Environment, use the az appservice ase show
command.
az appservice ase show --name <ASE_NAME> --resource-group <RESOURCE_GROUP>
Example Output:
This returns detailed information about the specified ASE, including its ID, name, location, subnet, internal load balancer, virtual network, status, scaling settings, and more.
{
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/hostingEnvironments/<ASE_NAME>", // ASE ID
"name": "<ASE_NAME>", // ASE Name
"location": "japaneast", // Region
"status": "Ready", // Status
"vnetName": "<VNET_NAME>", // Virtual Network Name
"vnetResourceGroupName": "<VNET_RESOURCE_GROUP>", // Virtual Network Resource Group
"virtualNetwork": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<VNET_RESOURCE_GROUP>/providers/Microsoft.Network/virtualNetworks/<VNET_NAME>", // Virtual Network ID
"subnet": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<VNET_RESOURCE_GROUP>/providers/Microsoft.Network/virtualNetworks/<VNET_NAME>/subnets/<SUBNET_NAME>", // Subnet ID
"internalLoadBalancingMode": "Web, Publishing", // Internal Load Balancer Mode
"ipSslAddressCount": 2, // IP SSL Address Count
"outboundIpAddresses": [ // Outbound IP Addresses
"52.164.132.1",
"52.164.132.2"
],
"defaultFrontEndScaleFactor": 15, // Default Frontend Scale Factor
"suspended": false // Suspension Status
}
Retrieving Details About App Service Plans
To filter and list App Service Plans related to a specific hosting environment and retrieve detailed information, use the az appservice plan list
command.
az appservice plan list --query "[?hostingEnvironmentProfile.name=='<HOSTING_ENVIRONMENT_NAME>']"
Example Output:
The details of each plan include ID, name, location, SKU information, and hosting environment profile.
[
{
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/serverfarms/<PLAN_NAME>", // App Service Plan ID
"name": "<PLAN_NAME>", // App Service Plan Name
"location": "japaneast", // Region
"sku": {
"name": "P1V2", // SKU Name
"tier": "PremiumV2", // SKU Tier
"size": "P1", // SKU Size
"family": "Pv2", // SKU Family
"capacity": 1 // Instance Count
},
"hostingEnvironmentProfile": {
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/hostingEnvironments/<HOSTING_ENVIRONMENT_NAME>" // Hosting Environment Profile ID
},
"resourceGroup": "<RESOURCE_GROUP>" // Resource Group Name
}
]
Listing Web Applications
To retrieve a list of Web Applications related to a specific hosting environment, use the az webapp list
command.
az webapp list --query "[?hostingEnvironmentProfile.name=='<HOSTING_ENVIRONMENT_NAME>']"
Example Output:
This returns a list of Web Applications related to the specified hosting environment, including details such as ID, name, location, resource group, and default hostname.
[
{
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/sites/<WEBAPP_NAME>", // Web Application ID
"name": "<WEBAPP_NAME>", // Web Application Name
"location": "japaneast", // Region
"resourceGroup": "<RESOURCE_GROUP>", // Resource Group Name
"defaultHostName": "<WEBAPP_NAME>.azurewebsites.net" // Default Hostname
}
]
Checking Application Configuration
To check the configuration of a Web Application, use the az webapp show
command.
az webapp show --name <WEBAPP_NAME> --resource-group <RESOURCE_GROUP>
Example Output:
This returns detailed information about the specified Web Application, including its state, default hostname, usage state, SSL state, and more.
{
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/sites/<WEBAPP_NAME>", // Web Application ID
"name": "<WEBAPP_NAME>", // Web Application Name
"state": "Running", // Application State
"defaultHostName": "<WEBAPP_NAME>.azurewebsites.net", // Default Hostname
"repositorySiteName": "<WEBAPP_NAME>", // Repository Site Name
"usageState": "Normal", // Usage State
"enabled": true, // Enabled Status
"enabledHostNames": [
"<WEBAPP_NAME>.azurewebsites.net", // Enabled Hostnames
"<WEBAPP_NAME>.scm.azurewebsites.net" // Enabled Hostname (SCM Site)
],
"hostNameSslStates": [
{
"name": "<WEBAPP_NAME>.azurewebsites.net", // Hostname
"sslState": "Disabled" // SSL State
}
],
"serverFarmId": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/serverfarms/<PLAN_NAME>" // Server Farm ID
}
Listing Connection Strings of Web Applications
To list the connection strings of a Web Application, use the az webapp config connection-string list
command.
az webapp config connection-string list --name <WEBAPP_NAME> --resource-group <RESOURCE_GROUP>
Example Output:
This returns the connection strings of the specified Web Application, including the type and value of each connection string.
{
"SQLAzure": {
"type": "SQLAzure", // Connection String Type
"value": "Server=tcp:<SERVER_NAME>.database.windows.net,1433;Database=<DATABASE_NAME>;User ID=<USER_ID>@<SERVER_NAME>;Password=<PASSWORD>;Encrypt=true;Connection Timeout=30;" // Connection String Value
}
}
Checking VNet Configuration
To check the configuration of virtual networks, use the az network vnet list
and az network vnet subnet list
commands.
To list the virtual networks within a specified resource group in a table format, use:
az network vnet list --resource-group <リソースグループ> --出力 テーブル
Example Output:
Name Location ResourceGroup
------------------ ---------- ----------------
sample-vnet japaneast sample-rg
To list the subnets within a specified virtual network, use:
az network vnet subnet list --resource-group <RESOURCE_GROUP> --vnet-name <VNET_NAME>
Example Output:
[
{
"name": "default", // Subnet Name
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Network/virtualNetworks/<VNET_NAME>/subnets/default", // Subnet ID
"addressPrefix": "10.0.0.0/24", // Address Prefix
"networkSecurityGroup": null, // Network Security Group
"routeTable": null // Route Table
}
]
3. Conclusion
By using the above commands, you can easily retrieve detailed information about applications hosted in an Azure App Service Environment. Utilize these commands to efficiently manage and troubleshoot your environment.