Skip to content

Commit 478d36e

Browse files
committed
add a few improvements
1 parent af2d3a7 commit 478d36e

File tree

2 files changed

+176
-1
lines changed

2 files changed

+176
-1
lines changed

articles/container-apps/containerapp-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.author: v-bcatherine
1313

1414
The `az containerapp up` (or `up`) command is the fastest way to deploy an app in Azure Container Apps from an existing image, local source code or a GitHub repo. With this single command, you can have your container app up and running in minutes.
1515

16-
The `az containerapp up` command is a streamlined way to create and deploy container apps that primarily use default settings. However, you'll need to use the `az containerapp create` command to for apps with customizations such as:
16+
The `az containerapp up` command is a streamlined way to create and deploy container apps that primarily use default settings. However, you'll need to use the `az containerapp create` command for apps with customizations such as:
1717

1818
- Dapr configuration
1919
- Secrets
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
title: 'Quickstart: Deploy your first container app'
3+
description: Deploy your first application to Azure Container Apps.
4+
services: container-apps
5+
author: craigshoemaker
6+
ms.service: container-apps
7+
ms.topic: quickstart
8+
ms.date: 03/21/2022
9+
ms.author: cshoe
10+
ms.custom: ignite-fall-2021, mode-api, devx-track-azurecli, event-tier1-build-2022
11+
ms.devlang: azurecli
12+
---
13+
14+
# Quickstart: Deploy your first container app
15+
16+
The Azure Container Apps service enables you to run microservices and containerized applications on a serverless platform. With Container Apps, you enjoy the benefits of running containers while you leave behind the concerns of manually configuring cloud infrastructure and complex container orchestrators.
17+
18+
In this quickstart, you create a secure Container Apps environment and deploy your first container app.
19+
20+
## Prerequisites
21+
22+
- An Azure account with an active subscription.
23+
- If you don't have one, you [can create one for free](https://azure.microsoft.com/free/).
24+
- Install the [Azure CLI](/cli/azure/install-azure-cli).
25+
26+
[!INCLUDE [container-apps-create-cli-steps.md](../../includes/container-apps-create-cli-steps.md)]
27+
28+
# [Bash](#tab/bash)
29+
30+
To create the environment, run the following command:
31+
32+
```azurecli
33+
az containerapp env create \
34+
--name $CONTAINERAPPS_ENVIRONMENT \
35+
--resource-group $RESOURCE_GROUP \
36+
--location $LOCATION
37+
```
38+
39+
# [Azure PowerShell](#tab/azure-powershell)
40+
41+
A Log Analytics workspace is required for the Container Apps environment. The following commands create a Log Analytics workspace and save the workspace ID and primary shared key to variables.
42+
43+
```azurepowershell
44+
$WorkspaceArgs = @{
45+
Name = 'myworkspace'
46+
ResourceGroupName = $ResourceGroupName
47+
Location = $Location
48+
PublicNetworkAccessForIngestion = 'Enabled'
49+
PublicNetworkAccessForQuery = 'Enabled'
50+
}
51+
New-AzOperationalInsightsWorkspace @WorkspaceArgs
52+
$WorkspaceId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroupName -Name $WorkspaceArgs.Name).CustomerId
53+
$WorkspaceSharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $ResourceGroupName -Name $WorkspaceArgs.Name).PrimarySharedKey
54+
```
55+
56+
To create the environment, run the following command:
57+
58+
```azurepowershell
59+
$EnvArgs = @{
60+
EnvName = $ContainerAppsEnvironment
61+
ResourceGroupName = $ResourceGroupName
62+
Location = $Location
63+
AppLogConfigurationDestination = 'log-analytics'
64+
LogAnalyticConfigurationCustomerId = $WorkspaceId
65+
LogAnalyticConfigurationSharedKey = $WorkspaceSharedKey
66+
}
67+
68+
New-AzContainerAppManagedEnv @EnvArgs
69+
```
70+
71+
---
72+
73+
## Create a container app
74+
75+
Now that you have an environment created, you can deploy your first container app. With the `containerapp create` command, deploy a container image to Azure Container Apps.
76+
77+
# [Bash](#tab/bash)
78+
79+
```azurecli
80+
az containerapp create \
81+
--name my-container-app \
82+
--resource-group $RESOURCE_GROUP \
83+
--environment $CONTAINERAPPS_ENVIRONMENT \
84+
--image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
85+
--target-port 80 \
86+
--ingress 'external' \
87+
--query properties.configuration.ingress.fqdn
88+
```
89+
90+
> [!NOTE]
91+
> Make sure the value for the `--image` parameter is in lower case.
92+
93+
By setting `--ingress` to `external`, you make the container app available to public requests.
94+
95+
# [Azure PowerShell](#tab/azure-powershell)
96+
97+
```azurepowershell
98+
$ImageParams = @{
99+
Name = 'my-container-app'
100+
Image = 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
101+
}
102+
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
103+
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $ContainerAppsEnvironment -ResourceGroupName $ResourceGroupName).Id
104+
105+
$AppArgs = @{
106+
Name = 'my-container-app'
107+
Location = $Location
108+
ResourceGroupName = $ResourceGroupName
109+
ManagedEnvironmentId = $EnvId
110+
IdentityType = 'SystemAssigned'
111+
TemplateContainer = $TemplateObj
112+
IngressTargetPort = 80
113+
IngressExternal = $true
114+
115+
}
116+
New-AzContainerApp @AppArgs
117+
```
118+
119+
> [!NOTE]
120+
> Make sure the value for the `Image` parameter is in lower case.
121+
122+
By setting `IngressExternal` to `$true`, you make the container app available to public requests.
123+
124+
---
125+
126+
## Verify deployment
127+
128+
# [Bash](#tab/bash)
129+
130+
The `create` command returns the fully qualified domain name for the container app. Copy this location to a web browser.
131+
132+
# [Azure PowerShell](#tab/azure-powershell)
133+
134+
Get the fully qualified domain name for the container app.
135+
136+
```azurepowershell
137+
(Get-AzContainerApp -Name $AppArgs.Name -ResourceGroupName $ResourceGroupName).IngressFqdn
138+
```
139+
140+
Copy this location to a web browser.
141+
142+
---
143+
144+
The following message is displayed when the container app is deployed:
145+
146+
:::image type="content" source="media/get-started/azure-container-apps-quickstart.png" alt-text="Your first Azure Container Apps deployment.":::
147+
148+
## Clean up resources
149+
150+
If you're not going to continue to use this application, run the following command to delete the resource group along with all the resources created in this quickstart.
151+
152+
>[!CAUTION]
153+
> The following command deletes the specified resource group and all resources contained within it. If resources outside the scope of this quickstart exist in the specified resource group, they will also be deleted.
154+
155+
# [Bash](#tab/bash)
156+
157+
```azurecli
158+
az group delete --name $RESOURCE_GROUP
159+
```
160+
161+
# [Azure PowerShell](#tab/azure-powershell)
162+
163+
```azurepowershell
164+
Remove-AzResourceGroup -Name $ResourceGroupName -Force
165+
```
166+
167+
---
168+
169+
> [!TIP]
170+
> Having issues? Let us know on GitHub by opening an issue in the [Azure Container Apps repo](https://github.com/microsoft/azure-container-apps).
171+
172+
## Next steps
173+
174+
> [!div class="nextstepaction"]
175+
> [Communication between microservices](communicate-between-microservices.md)

0 commit comments

Comments
 (0)