Skip to content

Commit 22a248f

Browse files
Merge pull request #210044 from craigshoemaker/aca/ext/deploy-vscode
[Container Apps] Tutorial update for new VS Code workflow
2 parents a08d2e6 + 7b7e196 commit 22a248f

File tree

4 files changed

+58
-59
lines changed

4 files changed

+58
-59
lines changed

articles/container-apps/deploy-visual-studio-code.md

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ author: alexwolfmsft
66
ms.author: alexwolf
77
ms.service: container-apps
88
ms.topic: tutorial
9-
ms.date: 4/05/2022
10-
ms.custom: mode-ui
9+
ms.date: 09/01/2022
10+
ms.custom: vscode-azure-extension-update-completed
1111
---
1212

1313
# Tutorial: Deploy to Azure Container Apps using Visual Studio Code
@@ -27,106 +27,105 @@ In this tutorial, you'll deploy a containerized application to Azure Container A
2727

2828
## Clone the project
2929

30-
To follow along with this tutorial, [Download the Sample Project](https://github.com/azure-samples/containerapps-albumapi-javascript/archive/refs/heads/master.zip) from [the repository](https://github.com/azure-samples/containerapps-albumapi-javascript) or clone it using the Git command below:
30+
1. Begin by cloning the [sample repository]((https://github.com/azure-samples/containerapps-albumapi-javascript) to your machine using the following command.
3131

32-
```bash
33-
git clone https://github.com/Azure-Samples/containerapps-albumapi-javascript.git
34-
cd containerapps-albumapi-javascript
35-
```
32+
```bash
33+
git clone https://github.com/Azure-Samples/containerapps-albumapi-javascript.git
34+
```
3635

37-
This tutorial uses a JavaScript project, but the steps are language agnostic. To open the project after cloning on Windows, navigate to the project's folder, and right click and choose **Open in VS Code**. For Mac or Linux, you can also use the Visual Studio Code user interface to open the sample project. Select **File -> Open Folder** and then navigate to the folder of the cloned project.
36+
> [!NOTE]
37+
> This tutorial uses a JavaScript project, but the steps are language agnostic.
38+
39+
1. Open Visual Studio Code.
40+
41+
1. Select **F1** to open the command palette.
42+
43+
1. Select **File > Open Folder...** and select the folder where you cloned the sample project.
3844

3945
## Sign in to Azure
4046

41-
To work with Container Apps and complete this tutorial, you'll need to be signed into Azure. Once you have the Azure Account extension installed, you can sign in using the command palette by typing **Ctrl + shift + p** on Windows and searching for the Azure Sign In command.
47+
1. Select **F1** to open the command palette.
4248

43-
:::image type="content" source="media/visual-studio-code/visual-studio-code-sign-in.png" alt-text="A screenshot showing how to sign in to Azure.":::
49+
1. Select **Azure: Sign In** and follow the prompts to authenticate.
4450

45-
Select **Azure: Sign in**, and Visual Studio Code will launch a browser for you to sign into Azure. Login with the account you'd like to use to work with Container Apps, and then switch back to Visual Studio Code.
51+
1. Once signed in, return to Visual Studio Code.
4652

4753
## Create the container registry and Docker image
4854

49-
The sample project includes a Dockerfile that is used to build a container image for the application. Docker images contain all of the source code and dependencies necessary to run an application. You can build and publish the image for your app directly in Azure; a local Docker installation is not required. An image is required to create and run a container app.
50-
51-
Container images are stored inside of container registries. You can easily create a container registry and upload an image of your app to it in a single workflow using Visual Studio Code.
55+
Docker images contain the source code and dependencies necessary to run an application. This sample project includes a Dockerfile used to build the application's container. Since you can build and publish the image for your app directly in Azure, a local Docker installation isn't required.
5256

53-
1) First, right click on the Dockerfile in the explorer, and select **Build Image in Azure**. You can also begin this workflow from the command palette by entering **Ctrl + Shift + P** on Windows or **Cmd + Shift + P** on a Mac. When the command palette opens, search for *Build Image in Azure* and select **Enter** on the matching suggestion.
57+
Container images are stored inside container registries. You can create a container registry and upload an image of your app in a single workflow using Visual Studio Code.
5458

55-
:::image type="content" source="media/visual-studio-code/visual-studio-code-build-in-azure-small.png" lightbox="media/visual-studio-code/visual-studio-code-build-in-azure.png" alt-text="A screenshot showing how to build the image in Azure.":::
59+
1. In the _Explorer_ window, expand the _src_ folder to reveal the Dockerfile.
5660

57-
2) As the command palette opens, you are prompted to enter a tag for the container. Accept the default, which uses the project name with the `{{.Run.ID}}` replacement token as a suffix. Select **Enter** to continue.
61+
1. Right select on the Dockerfile, and select **Build Image in Azure**.
5862

59-
:::image type="content" source="media/visual-studio-code/visual-studio-code-container-tag.png" alt-text="A screenshot showing Container Apps tagging.":::
63+
This action opens the command palette and prompts you to define a container tag.
6064

61-
3) Choose the subscription you would like to use to create your container registry and build your image, and then press enter to continue.
65+
1. Enter a tag for the container. Accept the default, which is the project name with the *latest* suffix.
6266

63-
4) Select **+ Create new registry**, or if you already have a registry you'd like to use, select that item and skip to creating and deloying to the container app.
67+
1. Select **+ Create new registry**, or if you already have a registry you'd like to use, select that item and skip to creating and deploying to the container app.
6468
65-
5) Enter a unique name for the new registry such as *msdocscapps123*, where 123 are unique numbers of your own choosing, and then press enter. Container registry names must be globally unique across all over Azure.
69+
1. Enter a unique name for the new registry such as `msdocscapps123`, where `123` are unique numbers of your own choosing, and then select enter.
6670
67-
6) Select **Basic** as the SKU.
71+
Container registry names must be globally unique across all over Azure.
6872
69-
7) Choose **+ Create new resource group**, or select an existing resource group you'd like to use. For a new resource group, enter a name such as `msdocscontainerapps`, and press enter.
73+
1. Select **Basic** as the SKU.
7074
71-
8) Finally, select the location that is nearest to you. Select **Enter** to finalize the workflow, and Azure begins creating the container registry and building the image. This may take a few moments to complete.
75+
1. Choose **+ Create new resource group**, or select an existing resource group you'd like to use.
7276

73-
Once the registry is created and the image is built successfully, you are ready to create the container app to host the published image.
77+
For a new resource group, enter a name such as `msdocscontainerapps`, and press enter.
7478

75-
## Create and deploy to the container app
79+
1. Select the location that is nearest to you. Select **Enter** to finalize the workflow, and Azure begins creating the container registry and building the image.
7680

77-
The Azure Container Apps extension for Visual Studio Code enables you to choose existing Container Apps resources, or create new ones to deploy your applications to. In this scenario you create a new Container App environment and container app to host your application. After installing the Container Apps extension, you can access its features under the Azure control panel in Visual Studio Code.
81+
This process may take a few moments to complete.
7882

79-
### Create the Container Apps environment
83+
Once the registry is created and the image is built successfully, you're ready to create the container app to host the published image.
8084
81-
Every container app must be part of a Container Apps environment. An environment provides an isolated network for one or more container apps, making it possible for them to easily invoke each other. You will need to create an environment before you can create the container app itself.
85+
## Create and deploy to the container app
8286
83-
1) In the Container Apps extension panel, right click on the subscription you would like to use and select **Create Container App Environment**.
87+
The Azure Container Apps extension for Visual Studio Code enables you to choose existing Container Apps resources, or create new ones to deploy your applications to. In this scenario, you create a new Container App environment and container app to host your application. After installing the Container Apps extension, you can access its features under the Azure control panel in Visual Studio Code.
8488
85-
:::image type="content" source="media/visual-studio-code/visual-studio-code-create-app-environment.png" alt-text="A screenshot showing how to create a Container Apps environment.":::
89+
### Create the Container Apps environment
8690
87-
2) A command palette workflow will open at the top of the screen. Enter a name for the new Container Apps environment, such as `msdocsappenvironment`, and select **Enter**.
91+
Every container app must be part of a Container Apps environment. An environment provides an isolated network for one or more container apps, making it possible for them to easily invoke each other. You'll need to create an environment before you can create the container app itself.
8892

89-
:::image type="content" source="media/visual-studio-code/visual-studio-code-container-app-environment.png" alt-text="A screenshot showing the container app environment.":::
93+
1. Select <kbd>F1</kbd> to open the command palette.
9094

91-
3) Select the desired location for the container app from the list of options.
95+
1. Enter **Azure Container Apps: Create Container Apps Environment...** and enter the following values as prompted by the extension.
9296

93-
:::image type="content" source="media/visual-studio-code/visual-studio-code-container-env-location.png" alt-text="A screenshot showing the app environment location.":::
97+
| Prompt | Value |
98+
|--|--|
99+
| Name | Enter **my-aca-environment** |
100+
| Region | Select the region closest to you |
94101

95-
Visual Studio Code and Azure will create the environment for you. This process may take a few moments to complete. Creating a container app environment also creates a log analytics workspace for you in Azure.
102+
Once you issue this command, Azure begins to create the environment for you. This process may take a few moments to complete. Creating a container app environment also creates a log analytics workspace for you in Azure.
96103

97104
### Create the container app and deploy the Docker image
98105

99106
Now that you have a container app environment in Azure you can create a container app inside of it. You can also publish the Docker image you created earlier as part of this workflow.
100107

101-
1) In the Container Apps extension panel, right click on the container environment you created previously and select **Create Container App**
102-
103-
:::image type="content" source="media/visual-studio-code/visual-studio-code-create-container-app.png" alt-text="A screenshot showing how to create the container app.":::
104-
105-
2) A new command palette workflow will open at the top of the screen. Enter a name for the new container app, such as `msdocscontainerapp`, and then select **Enter**.
106-
107-
:::image type="content" source="media/visual-studio-code/visual-studio-code-container-name.png" alt-text="A screenshot showing the container app name.":::
108-
109-
3) Next, you're prompted to choose a container registry hosting solution to pull a Docker image from. For this scenario, select **Azure Container Registries**, though Docker Hub is also supported.
110-
111-
4) Select the container registry you created previously when publishing the Docker image.
112-
113-
5) Select the container registry repository you published the Docker image to. Repositories allow you to store and organize your containers in logical groupings.
114-
115-
6) Select the tag of the image you published earlier.
116-
117-
7) When prompted for environment variables, choose **Skip for now**. This application does not require any environment variables.
118-
119-
8) Select **Enable** on the ingress settings prompt to enable an HTTP endpoint for your application.
108+
1. Select <kbd>F1</kbd> to open the command palette.
120109

121-
9) Choose **External** to configure the HTTP traffic that the endpoint will accept.
110+
1. Enter **Azure Container Apps: Create Container App...** and enter the following values as prompted by the extension.
122111

123-
10) Enter a value of 3500 for the port, and then select **Enter** to complete the workflow. This value should be set to the port number that your container uses, which in the case of the sample app is 3500.
112+
| Prompt | Value | Remarks |
113+
|--|--|--|
114+
| Environment | Select **my-aca-environment** | |
115+
| Name | Enter **my-container-app** | |
116+
| Container registry | Select **Azure Container Registries**, then select the registry you created as you published the container image. | |
117+
| Repository | Select the container registry repository where you published the container image. | |
118+
| Tag | Select **latest** | |
119+
| Environment variables | Select **Skip for now** | |
120+
| Ingress | Select **Enable** | |
121+
| HTTP traffic type | Select **External** | |
122+
| Port | Enter **3500** | You set this value to the port number that your container uses. |
124123

125-
During this process, Visual Studio Code and Azure create the container app for you. The published Docker image you created earlier is also be deployed to the app. Once this process finishes, Visual Studio Code displays a notification with a link to browse to the site. Click this link, and to view your app in the browser.
124+
During this process, Visual Studio Code and Azure create the container app for you. The published Docker image you created earlier is also be deployed to the app. Once this process finishes, Visual Studio Code displays a notification with a link to browse to the site. Select this link, and to view your app in the browser.
126125

127126
:::image type="content" source="media/visual-studio-code/visual-studio-code-app-deploy.png" alt-text="A screenshot showing the deployed app.":::
128127

129-
You can also append the `/albums` path at the end of the app URL to view data from a sample API request.
128+
You can also append the `/albums` path at the end of the app URL to view data from a sample API request.
130129

131130
Congratulations! You successfully created and deployed your first container app using Visual Studio code.
132131

Binary file not shown.

0 commit comments

Comments
 (0)