Skip to content

Commit bac92f6

Browse files
committed
add note to quickstart and tutorial to point to each other
1 parent 946a323 commit bac92f6

File tree

2 files changed

+132
-59
lines changed

2 files changed

+132
-59
lines changed

articles/container-apps/quickstart-code-to-cloud.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Quickstart: Build and deploy your container app from a repository in Azure Container Apps"
3-
description: Build your container app from a local or GitHub source repository and deploy in Azure Container Apps.
2+
title: "Quickstart: Build and deploy your app from a repository to Azure Container Apps"
3+
description: Build your container app from a local or GitHub source repository and deploy in Azure Container Apps using az containerapp up.
44
services: container-apps
55
author: cebundy
66
ms.service: container-apps
@@ -18,6 +18,9 @@ This article demonstrates how to build and deploy a microservice to Azure Contai
1818

1919
In this quickstart, you create a backend web API service that returns a static collection of music albums. After this completing this quickstart, you can continue to [Tutorial: Communication between microservices in Azure Container Apps](communicate-between-microservices.md) to learn how to deploy a front end application that calls the API.
2020

21+
> [!NOTE]
22+
> You can also build and deploy this sample application using the `az containerapp up` command. For more information, see [Tutorial: Build and deploy your app to Azure Container Apps](tutorial-code-to-cloud.md).
23+
2124
The following screenshot shows the output from the album API service you'll deploy.
2225

2326
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::

articles/container-apps/tutorial-code-to-cloud.md

Lines changed: 127 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Quickstart: Deploy your code to Azure Container Apps"
3-
description: Code to cloud deploying your application to Azure Container Apps
2+
title: "Tutorial: Build and deploy your app to Azure Container Apps"
3+
description: Build and deploy your app to Azure Container Apps with az containerapp create command
44
services: container-apps
55
author: craigshoemaker
66
ms.service: container-apps
@@ -11,26 +11,31 @@ zone_pivot_groups: container-apps-image-build-type
1111
---
1212

1313

14-
# Quickstart: Deploy your code to Azure Container Apps
14+
# Tutorial: Build and deploy your app to Azure Container Apps
1515

1616
This article demonstrates how to build and deploy a microservice to Azure Container Apps from a source repository using the programming language of your choice.
1717

1818
This tutorial is the first in a series of articles that walk you through how to use core capabilities within Azure Container Apps. The first step is to create a back end web API service that returns a static collection of music albums.
1919

20+
> [!NOTE]
21+
> You can also build and deploy this app using the [az containerapp up](/cli/azure/containerapp?view=azure-cli-latest#az_containerapp_up) by following the instructions in the [Quickstart: Build and deploy an app to Azure Container Apps from a repository](quickstart-code-to-cloud.md) article. The `az containerapp up` command is a fast and convenient way to build and deploy your app to Azure Container Apps using a single command. However, it doesn't provide the same level of customization for your container app.
22+
23+
The next tutorial in the series will build and deploy the front end web application to Azure Container Apps.
24+
2025
The following screenshot shows the output from the album API deployed in this tutorial.
2126

2227
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::
2328

2429
## Prerequisites
2530

26-
To complete this project, you'll need the following items:
31+
To complete this project, you need the following items:
2732

2833
::: zone pivot="acr-remote"
2934

3035
| Requirement | Instructions |
3136
|--|--|
3237
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. <br><br>Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md?tabs=current) for details. |
33-
| GitHub Account | Sign up for [free](https://github.com/join). |
38+
| GitHub Account | Sign-up for [free](https://github.com/join). |
3439
| git | [Install git](https://git-scm.com/downloads) |
3540
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
3641

@@ -41,7 +46,7 @@ To complete this project, you'll need the following items:
4146
| Requirement | Instructions |
4247
|--|--|
4348
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md?tabs=current) for details. |
44-
| GitHub Account | Sign up for [free](https://github.com/join). |
49+
| GitHub Account | Sign-up for [free](https://github.com/join). |
4550
| git | [Install git](https://git-scm.com/downloads) |
4651
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
4752
| Docker Desktop | Docker provides installers that configure the Docker environment on [macOS](https://docs.docker.com/docker-for-mac/), [Windows](https://docs.docker.com/docker-for-windows/), and [Linux](https://docs.docker.com/engine/installation/#supported-platforms). <br><br>From your command prompt, type `docker` to ensure Docker is running. |
@@ -127,12 +132,10 @@ az group create \
127132
--location "$LOCATION"
128133
```
129134

130-
# [PowerShell](#tab/powershell)
135+
# [Azure PowerShell](#tab/azure-powershell)
131136

132-
```powershell
133-
az group create `
134-
--name $RESOURCE_GROUP `
135-
--location "$LOCATION"
137+
```azurepowershell
138+
New-AzResourceGroup -Location $Location -Name $ResourceGroup
136139
```
137140

138141
---
@@ -151,14 +154,10 @@ az acr create \
151154
--admin-enabled true
152155
```
153156

154-
# [PowerShell](#tab/powershell)
157+
# [Azure PowerShell](#tab/azure-powershell)
155158

156-
```powershell
157-
az acr create `
158-
--resource-group $RESOURCE_GROUP `
159-
--name $ACR_NAME `
160-
--sku Basic `
161-
--admin-enabled true
159+
```azurepowershell
160+
$acr = New-AzContainerRegistry -ResourceGroupName $ResourceGroup -Name $ACRName -Sku Basic -EnableAdminUser
162161
```
163162

164163
---
@@ -179,10 +178,10 @@ Run the following command to initiate the image build and push process using ACR
179178
az acr build --registry $ACR_NAME --image $API_NAME .
180179
```
181180

182-
# [PowerShell](#tab/powershell)
181+
# [Azure PowerShell](#tab/azure-powershell)
183182

184-
```powershell
185-
az acr build --registry $ACR_NAME --image $API_NAME .
183+
```azurepowershell
184+
az acr build --registry $ACRName --image $APIName .
186185
```
187186

188187
---
@@ -207,10 +206,10 @@ The following command builds a container image for the album API and tags it wit
207206
docker build --tag $ACR_NAME.azurecr.io/$API_NAME .
208207
```
209208

210-
# [PowerShell](#tab/powershell)
209+
# [Azure PowerShell](#tab/azure-powershell)
211210

212211
```powershell
213-
docker build --tag "$ACR_NAME.azurecr.io/$API_NAME" .
212+
docker build --tag "$ACRName.azurecr.io/$APIName" .
214213
```
215214

216215
---
@@ -225,10 +224,10 @@ First, sign in to your Azure Container Registry.
225224
az acr login --name $ACR_NAME
226225
```
227226

228-
# [PowerShell](#tab/powershell)
227+
# [Azure PowerShell](#tab/azure-powershell)
229228

230229
```powershell
231-
az acr login --name $ACR_NAME
230+
az acr login --name $ACRName
232231
```
233232

234233
---
@@ -241,10 +240,10 @@ Now, push the image to your registry.
241240
docker push $ACR_NAME.azurecr.io/$API_NAME
242241
```
243242

244-
# [PowerShell](#tab/powershell)
243+
# [Azure PowerShell](#tab/azure-powershell)
245244

246245
```powershell
247-
docker push "$ACR_NAME.azurecr.io/$API_NAME"
246+
docker push "$ACRName.azurecr.io/$APIName"
248247
```
249248

250249
---
@@ -266,13 +265,36 @@ az containerapp env create \
266265
--location "$LOCATION"
267266
```
268267

269-
# [PowerShell](#tab/powershell)
268+
# [Azure PowerShell](#tab/azure-powershell)
269+
270+
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.
271+
272+
```azurepowershell
273+
$WorkspaceArgs = @{
274+
Name = 'my-album-workspace'
275+
ResourceGroupName = $ResourceGroup
276+
Location = $Location
277+
PublicNetworkAccessForIngestion = 'Enabled'
278+
PublicNetworkAccessForQuery = 'Enabled'
279+
}
280+
New-AzOperationalInsightsWorkspace @WorkspaceArgs
281+
$WorkspaceId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroup -Name $WorkspaceArgs.Name).CustomerId
282+
$WorkspaceSharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $ResourceGroup -Name $WorkspaceArgs.Name).PrimarySharedKey
283+
```
270284

271-
```azurecli
272-
az containerapp env create `
273-
--name $ENVIRONMENT `
274-
--resource-group $RESOURCE_GROUP `
275-
--location $LOCATION
285+
To create the environment, run the following command:
286+
287+
```azurepowershell
288+
$EnvArgs = @{
289+
EnvName = $Environment
290+
ResourceGroupName = $ResourceGroup
291+
Location = $Location
292+
AppLogConfigurationDestination = 'log-analytics'
293+
LogAnalyticConfigurationCustomerId = $WorkspaceId
294+
LogAnalyticConfigurationSharedKey = $WorkspaceSharedKey
295+
}
296+
297+
New-AzContainerAppManagedEnv @EnvArgs
276298
```
277299

278300
---
@@ -293,52 +315,100 @@ az containerapp create \
293315
--image $ACR_NAME.azurecr.io/$API_NAME \
294316
--target-port 3500 \
295317
--ingress 'external' \
296-
--registry-server $ACR_NAME.azurecr.io
318+
--registry-server $ACR_NAME.azurecr.io \
319+
--query properties.configuration.ingress.fqdn
297320
```
298321

299-
# [PowerShell](#tab/powershell)
322+
* By setting `--ingress` to `external`, your container app will be accessible from the public internet.
300323

301-
```azurecli
302-
az containerapp create `
303-
--name $API_NAME `
304-
--resource-group $RESOURCE_GROUP `
305-
--environment $ENVIRONMENT `
306-
--image "$ACR_NAME.azurecr.io/$API_NAME" `
307-
--target-port 3500 `
308-
--ingress 'external' `
309-
--registry-server "$ACR_NAME.azurecr.io"
324+
* The `target-port` is set to `3500` to match the port that the container is listening to for requests.
325+
326+
* Without a `query` property, the call to `az containerapp create` returns a JSON response that includes a rich set of details about the application. Adding a query parameter filters the output to just the app's fully qualified domain name (FQDN).
327+
328+
# [Azure PowerShell](#tab/azure-powershell)
329+
330+
To create the container app, create template objects that you'll pass in as arguments to the `New-AzContainerApp` command.
331+
332+
Create a template object to define your container image parameters.
333+
334+
```azurepowershell
335+
$ImageParams = @{
336+
Name = $APIName
337+
Image = $ACRName + '.azurecr.io/' + $APIName + ':latest'
338+
}
339+
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
310340
```
311341

312-
---
342+
You'll need run the following command to get your registry credentials.
313343

314-
* By setting `--ingress` to `external`, your container app will be accessible from the public internet.
344+
```azurepowershell
345+
$RegistryCredentials = Get-AzContainerRegistryCredential -Name $ACRName -ResourceGroupName $ResourceGroup
346+
```
315347

316-
* The `target-port` is set to `3500` to match the port the that the container is listing to for requests.
348+
Create a registry credential object to define your registry information, and a secret object to define your registry password. The `PasswordSecretRef` refers to the `Name` in the secret object.
317349

318-
* Without a `query` property, the call to `az containerapp create` returns a JSON response that includes a rich set of details about the application. By adding a query, this command filters the response down to just the FQDN.
350+
```azurepowershell
351+
$RegistryArgs = @{
352+
Server = $ACRName + '.azurecr.io'
353+
PasswordSecretRef = 'registrysecret'
354+
Username = $RegistryCredentials.Username
355+
}
356+
$RegistryObj = New-AzContainerAppRegistryCredentialObject @RegistryArgs
319357
320-
## Verify deployment
358+
$SecretObj = New-AzContainerAppSecretObject -Name 'registrysecret' -Value $RegistryCredentials.Password
359+
```
360+
361+
Get your environment ID.
362+
363+
```azurepowershell
364+
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $Environment -ResourceGroup $ResourceGroup).Id
365+
```
321366

322-
The `az containerapp create` command returns the fully qualified domain name (FQDN) for the container app. Copy the FQDN to a web browser.
367+
Create the container app.
368+
369+
```azurepowershell
370+
$AppArgs = @{
371+
Name = $APIName
372+
Location = $Location
373+
ResourceGroupName = $ResourceGroup
374+
ManagedEnvironmentId = $EnvId
375+
TemplateContainer = $TemplateObj
376+
ConfigurationRegistry = $RegistryObj
377+
ConfigurationSecret = $SecretObj
378+
IngressTargetPort = 3500
379+
IngressExternal = $true
380+
}
381+
$MyApp = New-AzContainerApp @AppArgs
382+
383+
# show the app's fully qualified domain name (FQDN).
384+
$MyApp.IngressFqdn
385+
```
323386

324-
From your web browser, navigate to the `/albums` endpoint of the FQDN.
387+
* By setting `IngressExternal` to `external`, your container app will be accessible from the public internet.
388+
* The `IngressTargetPort` parameter is set to `3500` to match the port that the container is listening to for requests.
389+
390+
---
391+
392+
## Verify deployment
393+
394+
Copy the FQDN to a web browser. From your web browser, navigate to the `/albums` endpoint of the FQDN.
325395

326396
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::
327397

328398
## Clean up resources
329399

330-
If you're not going to continue on to the [Deploy a frontend](communicate-between-microservices.md) tutorial, you can remove the Azure resources created during this tutorial. Run the following command to delete the resource group along with all the resources created in this tutorial.
400+
If you're not going to continue on to the [Communication between microservices](communicate-between-microservices.md) tutorial, you can remove the Azure resources created during this quickstart. Run the following command to delete the resource group along with all the resources created in this quickstart.
331401

332402
# [Bash](#tab/bash)
333403

334404
```azurecli
335405
az group delete --name $RESOURCE_GROUP
336406
```
337407

338-
# [PowerShell](#tab/powershell)
408+
# [Azure PowerShell](#tab/azure-powershell)
339409

340-
```powershell
341-
az group delete --name $RESOURCE_GROUP
410+
```azurepowershell
411+
Remove-AzResourceGroup -Name $ResourceGroup -Force
342412
```
343413

344414
---
@@ -348,7 +418,7 @@ az group delete --name $RESOURCE_GROUP
348418
349419
## Next steps
350420

351-
This tutorial is the entrypoint for a set of progressive tutorials that showcase the various features within Azure Container Apps. Continue on to learn how to enable communication from a web front end that calls the API you deployed in this article.
421+
This quickstart is the entrypoint for a set of progressive tutorials that showcase the various features within Azure Container Apps. Continue on to learn how to enable communication from a web front end that calls the API you deployed in this article.
352422

353423
> [!div class="nextstepaction"]
354-
> [Tutorial: Communication between microservices](communicate-between-microservices.md)
424+
> [Tutorial: Communication between microservices](co

0 commit comments

Comments
 (0)