You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/quickstart-code-to-cloud.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
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.
4
4
services: container-apps
5
5
author: cebundy
6
6
ms.service: container-apps
@@ -18,6 +18,9 @@ This article demonstrates how to build and deploy a microservice to Azure Contai
18
18
19
19
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.
20
20
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
+
21
24
The following screenshot shows the output from the album API service you'll deploy.
22
25
23
26
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::
# Quickstart: Deploy your code to Azure Container Apps
14
+
# Tutorial: Build and deploy your app to Azure Container Apps
15
15
16
16
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.
17
17
18
18
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.
19
19
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
+
20
25
The following screenshot shows the output from the album API deployed in this tutorial.
21
26
22
27
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::
23
28
24
29
## Prerequisites
25
30
26
-
To complete this project, you'll need the following items:
31
+
To complete this project, you need the following items:
27
32
28
33
::: zone pivot="acr-remote"
29
34
30
35
| Requirement | Instructions |
31
36
|--|--|
32
37
| 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 | Signup for [free](https://github.com/join). |
38
+
| GitHub Account | Sign-up for [free](https://github.com/join). |
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
36
41
@@ -41,7 +46,7 @@ To complete this project, you'll need the following items:
41
46
| Requirement | Instructions |
42
47
|--|--|
43
48
| 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 | Signup for [free](https://github.com/join). |
49
+
| GitHub Account | Sign-up for [free](https://github.com/join). |
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
47
52
| 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. |
@@ -225,10 +224,10 @@ First, sign in to your Azure Container Registry.
225
224
az acr login --name $ACR_NAME
226
225
```
227
226
228
-
# [PowerShell](#tab/powershell)
227
+
# [Azure PowerShell](#tab/azure-powershell)
229
228
230
229
```powershell
231
-
az acr login --name $ACR_NAME
230
+
az acr login --name $ACRName
232
231
```
233
232
234
233
---
@@ -241,10 +240,10 @@ Now, push the image to your registry.
241
240
docker push $ACR_NAME.azurecr.io/$API_NAME
242
241
```
243
242
244
-
# [PowerShell](#tab/powershell)
243
+
# [Azure PowerShell](#tab/azure-powershell)
245
244
246
245
```powershell
247
-
docker push "$ACR_NAME.azurecr.io/$API_NAME"
246
+
docker push "$ACRName.azurecr.io/$APIName"
248
247
```
249
248
250
249
---
@@ -266,13 +265,36 @@ az containerapp env create \
266
265
--location "$LOCATION"
267
266
```
268
267
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.
* By setting `--ingress` to `external`, your container app will be accessible from the public internet.
300
323
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.
* 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.
317
349
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.
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
+
```
323
386
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.
325
395
326
396
:::image type="content" source="media/quickstart-code-to-cloud/azure-container-apps-album-api.png" alt-text="Screenshot of response from albums API endpoint.":::
327
397
328
398
## Clean up resources
329
399
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.
@@ -348,7 +418,7 @@ az group delete --name $RESOURCE_GROUP
348
418
349
419
## Next steps
350
420
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.
352
422
353
423
> [!div class="nextstepaction"]
354
-
> [Tutorial: Communication between microservices](communicate-between-microservices.md)
424
+
> [Tutorial: Communication between microservices](co
0 commit comments