From 7fd4356fb72a83de2d3700fca53fc21b8ddb0462 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 09:22:46 -0500 Subject: [PATCH 01/14] tweaks --- docs/deployment/azure/aca-deployment.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/deployment/azure/aca-deployment.md b/docs/deployment/azure/aca-deployment.md index 55c9c1380..f2f40ce7d 100644 --- a/docs/deployment/azure/aca-deployment.md +++ b/docs/deployment/azure/aca-deployment.md @@ -7,13 +7,13 @@ zone_pivot_groups: azure-development-tool # Deploy a .NET Aspire app to Azure Container Apps -.NET Aspire apps are designed to run in containerized environments. Azure Container Apps is a fully managed environment that enables you to run microservices and containerized applications on a serverless platform. This article will walk you through creating a new .NET Aspire solution and deploying it to Microsoft Azure Container Apps using Bicep and the Azure CLI. You'll learn how to complete the following tasks: +.NET Aspire apps are designed to run in containerized environments. Azure Container Apps is a fully managed environment that enables you to run microservices and containerized applications on a serverless platform. This article will walk you through creating a new .NET Aspire solution and deploying it to Microsoft Azure Container Apps using the Azure Developer CLI (`azd`), the Azure CLI, or Bicep. You'll learn how to complete the following tasks: > [!div class="checklist"] > -> - Provision an Azure resource group and Container Registry using Bicep and the Azure CLI +> - Provision an Azure resource group and Container Registry > - Publish the .NET Aspire projects as container images in Azure Container Registry -> - Provision a Redis container in Azure using Bicep and the Azure CLI +> - Provision a Redis container in Azure > - Deploy the apps to an Azure Container Apps environment > - View application console logs to troubleshoot application issues From 7d325d8fdd6d67b0aff28c8612bdc8130b3981ef Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:07:00 -0500 Subject: [PATCH 02/14] azd updates --- .../azure/aca-deployment-azd-in-depth.md | 109 +++++++++--------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index bacfc85c8..ec3bcfbb2 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -8,6 +8,22 @@ ms.date: 11/11/2023 The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI. +## How AZD integration works + +The `azd init` workflow provides customized supported for .NET Aspire projects. The following diagram illustrates conceptually how this flow works and how AZD and .NET Aspire are integrated: + +![Illustration of internal processing of AZD when deploying .NET Aspire application](../media/azd-internals.png) + +1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), this produces the Aspire manifest file. For more information on the Aspire manifest file format see: [.NET Aspire manifest format for deployment tool builders](../manifest-format.md). +1. The Aspire manifest file is interrogated by AZD's `provision` sub-command logic to generate Bicep files in-memory only (by default). +1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. +1. Once the underlying Azure resources are configured the `deploy` sub-command logic is executed which uses the same Aspire manifest file. +1. As part of deployment AZD calls out to `dotnet publish` using .NET's built in container publishing support to generate container images. +1. Once AZD has built the container images it pushes them to the ACR registry that was created during the provisioning phase. +1. Finally, once the container image is in ACR, AZD updates the resource using ARM to start using the new version of the container image. + +`azd` also enables you to output the generated Bicep to an `infra` folder in your project, which you can read more about in the [Generating Bicep from .NET Aspire app model](/dotnet/aspire/deployment/azure/aca-deployment-azd-in-depth?branch=main#generate-bicep-from-net-aspire-app-model) section. + ## Create .NET Aspire app from starter template The first step is to create a new .NET Aspire application. In this example the `dotnet new` command is being used, although you can create the project Visual Studio as well. @@ -22,35 +38,36 @@ The previous commands create a new .NET Aspire application based on the `aspire- ## Initialize AZD -Before deploying a .NET Aspire application with AZD, the repository/path containing the app needs to be initialized. To download AZD, see [Install or update the Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd). To initialize, run the following command: +Before deploying a .NET Aspire application with AZD, the repository/path containing the app needs to be initialized. To download AZD, see [Install or update the Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd). -```azurecli -azd init -``` +1. Run the following command to initialize your project with `azd`: -AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. + ```azurecli + azd init + ``` -:::image type="content" source="../media/azd-prompt-init-path.png" lightbox="../media/azd-prompt-init-path.png" alt-text"A screenshot of AZD prompting whether to scan current directory or use a template."::: +1. AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. -After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. + :::image type="content" source="../media/azd-prompt-init-path.png" lightbox="../media/azd-prompt-init-path.png" alt-text"A screenshot of AZD prompting whether to scan current directory or use a template."::: -![Screenshot of AZD confirming the detected location of the .NET Aspire application](../media/azd-prompt-confirm-path.png) +1. After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. -Once the path to the AppHost is confirmed AZD will analyze the .NET Aspire app model defined -in the AppHost and prompt which of the projects referenced in the app model should be exposed -via a public endpoint. For the starter application template only the `webfrontend` should be -exposed on a public endpoint. + ![Screenshot of AZD confirming the detected location of the .NET Aspire application](../media/azd-prompt-confirm-path.png) + + Once the path to the AppHost is confirmed AZD will analyze the .NET Aspire app model defined + in the AppHost and prompt which of the projects referenced in the app model should be exposed + via a public endpoint. For the starter application template only the `webfrontend` should be + exposed on a public endpoint. -![Screenshot of AZD prompting which .NET projects should have public endpoints](../media/azd-prompt-select-endpoints.png) + ![Screenshot of AZD prompting which .NET projects should have public endpoints](../media/azd-prompt-select-endpoints.png) -The final step in initializing AZD to work with the .NET Aspire code base is to select an +1. The final step in initializing AZD to work with the .NET Aspire code base is to select an environment name. The environment forms part of an Azure resource-group name when deploying the .NET Aspire application. For now select the name **aspireazddev**. -![Screenshot of final AZD output after initialization](../media/azd-prompt-final.png) + ![Screenshot of final AZD output after initialization](../media/azd-prompt-final.png) -After providing the environment name AZD will generate a number of files and place them -into the working directory. These files are: +`azd` generates a number of files and places them into the working directory. These files are: - `azure.yaml`; this file tell AZD where to find the .NET Aspire AppHost project. - `.azure\config.json`; configuration file that tells AZD what the current active environment is. @@ -96,32 +113,31 @@ exposed with a public endpoint. AZD can be configured to support multiple enviro ## Initial deployment -In order to deploy the .NET Aspire application to Azure AZD will need to get authorization -to call the Azure resource management APIs. +1. In order to deploy the .NET Aspire application, authenticate to Azure AZD to call the Azure resource management APIs. -```azurecli -azd auth login -``` + ```azurecli + azd auth login + ``` -The previous command will launch a browser to authenticate the command-line session. Once -authenticated use the following command to provision and deploy the application. +The previous command will launch a browser to authenticate the command-line session. -```dotnetcli -azd up -``` - -Before deploying the application AZD needs to know which subscription and location the -resources should be deployed. Once these options are selected the .NET Aspire application -will be deployed. +1. Once authenticated use the following command to provision and deploy the application. -![Screenshot of AZD output after azd up command is executed](../media/azd-up-final.png) + ```dotnetcli + azd up + ``` -The final line of output from the AZD command is a link to the Azure Portal that shows -all of the Azure resources that were deployed: +1. When prompted, select the subscription and location the resources should be deployed to. Once these options are selected the .NET Aspire application +will be deployed. -![Screenshot of Azure Portal showing deployed resources](../media/azd-azure-portal-deployed-resources.png) + ![Screenshot of AZD output after azd up command is executed](../media/azd-up-final.png) + + The final line of output from the AZD command is a link to the Azure Portal that shows + all of the Azure resources that were deployed: + + ![Screenshot of Azure Portal showing deployed resources](../media/azd-azure-portal-deployed-resources.png) -Note that there are three containers deployed within this application. These are: +Three containers are deployed within this application: - `webfrontend`; contains code from the web project in the starter template. - `apiservice`; contains code from the API service project in the starter template. @@ -214,25 +230,11 @@ group and contained resources should be deleted. ![Screenshot showing results of azd down command](../media/azd-down-success.png) -## How AZD integration works - -The following diagram illustrates conceptually how AZD and .NET Aspire are integrated: - -![Illustration of internal processing of AZD when deploying .NET Aspire application](../media/azd-internals.png) - -1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), this produces the Aspire manifest file. For more information on the Aspire manifest file format see: [.NET Aspire manifest format for deployment tool builders](../manifest-format.md). -1. The Aspire manifest file is interrogated by AZD's `provision` sub-command logic to generate Bicep files (in memory). -1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. -1. Once the underlying Azure resources are configured the `deploy` sub-command logic is executed which uses the same Aspire manifest file. -1. As part of deployment AZD calls out to `dotnet publish` using .NET's built in container publishing support to generate container images. -1. Once AZD has built the container images it pushes them to the ACR registry that was created during the provisioning phase. -1. Finally, once the container image is in ACR, AZD updates the resource using ARM to start using the new version of the container image. - -## Generating Bicep from .NET Aspire app model using AZD +## Generate Bicep from .NET Aspire app model using AZD Although development teams are free to use `azd up` (or `azd provision` and `azd deploy`) commands for their deployments both for development and production -purposes, some teams may choose to generate Bicep files that they can review and manage as part of version control (this also allows these -Bicep files to be referenced as part of a larger more complex Azure deployment). +purposes, some teams may choose to generate Bicep files that they can review and manage as part of version control. This also allows these +Bicep files to be referenced as part of a larger more complex Azure deployment. AZD includes the ability to output the Bicep it uses for provisioning via following command: @@ -412,6 +414,7 @@ After executing the `azd infra synth` command, when `azd provision` and `azd dep use the Bicep and supporting files generated above. Note that if `azd infra synth` is executed again it will replace any modified files with freshly generated ones (with a confirmation prompt). + ## Working in teams Because AZD makes it easy to provision new environments, it is possible for each team member to have an From d279820a434f77647ca87a80ff106b7e3fab9f67 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:34:11 -0500 Subject: [PATCH 03/14] tweaks --- .../azure/aca-deployment-azd-in-depth.md | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index a09fb30e3..a4349b3b6 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -12,7 +12,7 @@ The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire The `azd init` workflow provides customized supported for .NET Aspire projects. The following diagram illustrates conceptually how this flow works and how AZD and .NET Aspire are integrated: -![Illustration of internal processing of AZD when deploying .NET Aspire application](../media/azd-internals.png) +![Illustration of internal processing of AZD when deploying .NET Aspire application](media/azd-internals.png) 1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), this produces the Aspire manifest file. For more information on the Aspire manifest file format see: [.NET Aspire manifest format for deployment tool builders](../manifest-format.md). 1. The Aspire manifest file is interrogated by AZD's `provision` sub-command logic to generate Bicep files in-memory only (by default). @@ -48,18 +48,18 @@ Before deploying a .NET Aspire application with AZD, the repository/path contain 1. AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. - :::image type="content" source="../media/azd-prompt-init-path.png" lightbox="../media/azd-prompt-init-path.png" alt-text"A screenshot of AZD prompting whether to scan current directory or use a template."::: + :::image type="content" source="media/azd-prompt-init-path.png" lightbox="media/azd-prompt-init-path.png" alt-text"A screenshot of AZD prompting whether to scan current directory or use a template."::: 1. After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. - ![Screenshot of AZD confirming the detected location of the .NET Aspire application](../media/azd-prompt-confirm-path.png) + ![Screenshot of AZD confirming the detected location of the .NET Aspire application](media/azd-prompt-confirm-path.png) Once the path to the AppHost is confirmed AZD will analyze the .NET Aspire app model defined in the AppHost and prompt which of the projects referenced in the app model should be exposed via a public endpoint. For the starter application template only the `webfrontend` should be exposed on a public endpoint. - ![Screenshot of AZD prompting which .NET projects should have public endpoints](../media/azd-prompt-select-endpoints.png) + ![Screenshot of AZD prompting which .NET projects should have public endpoints](media/azd-prompt-select-endpoints.png) 1. The final step in initializing AZD to work with the .NET Aspire code base is to select an environment name. The environment forms part of an Azure resource-group name when deploying @@ -126,12 +126,12 @@ The previous command will launch a browser to authenticate the command-line sess 1. When prompted, select the subscription and location the resources should be deployed to. Once these options are selected the .NET Aspire application will be deployed. - ![Screenshot of AZD output after azd up command is executed](../media/azd-up-final.png) + ![Screenshot of AZD output after azd up command is executed](media/azd-up-final.png) The final line of output from the AZD command is a link to the Azure Portal that shows all of the Azure resources that were deployed: - ![Screenshot of Azure Portal showing deployed resources](../media/azd-azure-portal-deployed-resources.png) + ![Screenshot of Azure Portal showing deployed resources](media/azd-azure-portal-deployed-resources.png) Three containers are deployed within this application: @@ -211,20 +211,6 @@ The previous command may take some time to execute, but when completed the resou :::image type="content" source="media/azd-down-success.png" lightbox="media/azd-down-success.png" alt-text="A screenshot showing the azd down command output."::: -## How AZD integration works - -The following diagram illustrates conceptually how AZD and .NET Aspire are integrated: - -:::image type="content" source="media/azd-internals.png" lightbox="media/azd-internals.png" alt-text="An illustration of the internal processing of AZD when deploying .NET Aspire app."::: - -1. When AZD targets an .NET Aspire app it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), this produces the Aspire manifest file. For more information on the Aspire manifest file format see, [.NET Aspire manifest format for deployment tool builders](../manifest-format.md). -1. The Aspire manifest file is interrogated by AZD's `provision` sub-command logic to generate Bicep files (in memory). -1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targeting the subscription and resource group provided earlier. -1. Once the underlying Azure resources are configured the `deploy` sub-command logic is executed which uses the same Aspire manifest file. -1. As part of deployment AZD calls out to `dotnet publish` using .NET's built in container publishing support to generate container images. -1. Once AZD has built the container images it pushes them to the ACR registry that was created during the provisioning phase. -1. Finally, once the container image is in ACR, AZD updates the resource using ARM to start using the new version of the container image. - ## Generate Bicep from .NET Aspire app model Although development teams are free to use `azd up` (or `azd provision` and `azd deploy`) commands for their deployments both for development and production purposes, some teams may choose to generate Bicep files that they can review and manage as part of version control (this also allows these Bicep files to be referenced as part of a larger more complex Azure deployment). From 06a00617df422404fe8bb61581a20165a1ff54e8 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:40:45 -0500 Subject: [PATCH 04/14] fix image --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index a4349b3b6..684accaf9 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -48,7 +48,7 @@ Before deploying a .NET Aspire application with AZD, the repository/path contain 1. AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. - :::image type="content" source="media/azd-prompt-init-path.png" lightbox="media/azd-prompt-init-path.png" alt-text"A screenshot of AZD prompting whether to scan current directory or use a template."::: + ![Screenshot of AZD confirming the detected location of the .NET Aspire application](media/azd-prompt-init-path.png) 1. After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. From 2a63590091820a211ffc061aa559506ec0778ea1 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:56:26 -0500 Subject: [PATCH 05/14] updates --- .../azure/aca-deployment-azd-in-depth.md | 56 ++++++++++++++----- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 684accaf9..9db77c3dc 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -6,7 +6,31 @@ ms.date: 11/13/2023 # Deploy a .NET Aspire app to Azure Container Apps using AZD (in-depth guide) -The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI. +The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI and learn the following concepts: + +> [!div class="checklist"] +> +> - Explore how `azd` integration works with .NET Aspire apps +> - Provision and deploy resources on Azure for a .NET Aspire app using `azd` +> - Generate Bicep infrastructure and other template files using `azd` + +[!INCLUDE [aspire-prereqs](../../includes/aspire-prereqs.md)] + +You will also need to have the Azure Developer CLI [installed locally](/azure/developer/azure-developer-cli/install-azd). Common install options are as follows: + +# [Windows](#tab-windows) + +```powershell +winget install microsoft.azd +``` + +# [Mac](#tab-mac) + +```bash +brew tap azure/azd && brew install azd +``` + +--- ## How AZD integration works @@ -14,17 +38,21 @@ The `azd init` workflow provides customized supported for .NET Aspire projects. ![Illustration of internal processing of AZD when deploying .NET Aspire application](media/azd-internals.png) -1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), this produces the Aspire manifest file. For more information on the Aspire manifest file format see: [.NET Aspire manifest format for deployment tool builders](../manifest-format.md). -1. The Aspire manifest file is interrogated by AZD's `provision` sub-command logic to generate Bicep files in-memory only (by default). +1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file]((../manifest-format.md)). +1. The manifest file is interrogated by the `provision` sub-command logic to generate Bicep files in-memory only (by default). 1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. -1. Once the underlying Azure resources are configured the `deploy` sub-command logic is executed which uses the same Aspire manifest file. -1. As part of deployment AZD calls out to `dotnet publish` using .NET's built in container publishing support to generate container images. -1. Once AZD has built the container images it pushes them to the ACR registry that was created during the provisioning phase. -1. Finally, once the container image is in ACR, AZD updates the resource using ARM to start using the new version of the container image. +1. Once the underlying Azure resources are configured, the `deploy` sub-command logic is executed which uses the same Aspire manifest file. +1. As part of deployment `azd` makes a call to `dotnet publish` using .NET's built in container publishing support to generate container images. +1. Once `azd` has built the container images it pushes them to the ACR registry that was created during the provisioning phase. +1. Finally, once the container image is in ACR, `azd` updates the resource using ARM to start using the new version of the container image. `azd` also enables you to output the generated Bicep to an `infra` folder in your project, which you can read more about in the [Generating Bicep from .NET Aspire app model](/dotnet/aspire/deployment/azure/aca-deployment-azd-in-depth?branch=main#generate-bicep-from-net-aspire-app-model) section. -## Create .NET Aspire app from starter template +## Provision and deploy a .NET Aspire starter app + +The steps ahead demonstrate how to create a .NET Aspire start app and handle provisioning and deploying the app resources to Azure. + +### Create the .NET Aspire starter app The first step is to create a new .NET Aspire application. In this example the `dotnet new` command is being used, although you can create the project Visual Studio as well. @@ -36,9 +64,9 @@ dotnet run --project AspireAzdWalkthrough.AppHost\AspireAzdWalkthrough.AppHost.c The previous commands create a new .NET Aspire application based on the `aspire-starter` template which includes a dependency on Redis cache. It runs the .NET Aspire project which verifies that everything is working correctly. -## Initialize AZD +### Initialize AZD -Before deploying a .NET Aspire application with AZD, the repository/path containing the app needs to be initialized. To download AZD, see [Install or update the Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd). +Before deploying a .NET Aspire application with `azd`, the repository/path containing the app needs to be initialized. 1. Run the following command to initialize your project with `azd`: @@ -107,7 +135,7 @@ The _.azure\aspireazddev\config.json_ file has the following contents: This file is how AZD remembers (on a per environment basis) which services should be exposed with a public endpoint. AZD can be configured to support multiple environments -## Initial deployment +### Initial deployment 1. In order to deploy the .NET Aspire application, authenticate to Azure AZD to call the Azure resource management APIs. @@ -146,7 +174,7 @@ Just like in local development, the configuration of connection strings has been For more information on how .NET Aspire apps handle connection strings and service discovery, see [.NET Aspire orchestration overview](../../app-host-overview.md). -## Deploy application updates +### Deploy application updates When the `azd up` command is executed the underlying Azure resources are _provisioned_ and a container image is built and _deployed_ to the container apps hosting the .NET Aspire app. Typically once development is underway and Azure resources are deployed it won't be necessary to provision Azure resources every time code is updated—this is especially true for the developer inner loop. @@ -166,7 +194,7 @@ azd deploy webfrontend For more information, see [Azure Developer CLI reference: azd deploy](/azure/developer/azure-developer-cli/reference#azd-deploy). -## Deploy infrastructure updates +### Deploy infrastructure updates Whenever the dependency structure within a .NET Aspire app changes, AZD will need to re-provision the underlying Azure resources. The `azd provision` command is used to apply these changes to the infrastructure. @@ -199,7 +227,7 @@ azd provision The AZD provision command updates the infrastructure by creating a container app to host the Postgres database. The `azd provision` command didn't update the connection strings for the `apiservice` container. In order to have connection strings updated to point to the newly provisioned Postgres database the `azd deploy` command needs to be invoked again. When in doubt, use `azd up` to both provision and deploy. -## Clean up resources +### Clean up resources Remember to clean up the Azure resources that you've created during this walkthrough. Because AZD knows the resource group in which it created the resources it can be used to spin down the environment using the following command: From 95c0c236244015506fb06cb7f1d3a46997534230 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:57:41 -0500 Subject: [PATCH 06/14] removed sln --- docs-aspire.sln | 76 ------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 docs-aspire.sln diff --git a/docs-aspire.sln b/docs-aspire.sln deleted file mode 100644 index 445a9dbf7..000000000 --- a/docs-aspire.sln +++ /dev/null @@ -1,76 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.002.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{2F3D09B9-7108-4A11-AD4C-D48E8F5BC78D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{A8F8B0B9-BB92-461F-83C8-04E1DAFCCA55}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "template", "template", "{45A81FA3-202D-43AA-8C84-0E69ECA2D0C7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YourAppName.ServiceDefaults", "docs\snippets\template\YourAppName\YourAppName.ServiceDefaults.csproj", "{1410C0C9-73AE-4F05-A9E0-E82988B26E5E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "get-started", "get-started", "{FE88649E-2555-4602-BB5B-38ABDDF66E98}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{EE1D6925-D416-4584-AD2A-483EF9C784FB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "quickstart", "quickstart", "{A5FB2DC1-4083-4568-B7C8-20538CC7ACB1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspireSample", "AspireSample", "{D6D2CECF-CBFC-4FBB-AF11-E45490215BAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspireSample.ApiService", "docs\get-started\snippets\quickstart\AspireSample\AspireSample.ApiService\AspireSample.ApiService.csproj", "{1A038391-F03B-43DC-BEFF-35DF671DA56C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspireSample.AppHost", "docs\get-started\snippets\quickstart\AspireSample\AspireSample.AppHost\AspireSample.AppHost.csproj", "{0C3EAE6C-05B9-441D-BA48-6262C7B272CC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspireSample.ServiceDefaults", "docs\get-started\snippets\quickstart\AspireSample\AspireSample.ServiceDefaults\AspireSample.ServiceDefaults.csproj", "{83AAFEE0-AA67-4032-87A7-97D312621924}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspireSample.Web", "docs\get-started\snippets\quickstart\AspireSample\AspireSample.Web\AspireSample.Web.csproj", "{32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1410C0C9-73AE-4F05-A9E0-E82988B26E5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1410C0C9-73AE-4F05-A9E0-E82988B26E5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1410C0C9-73AE-4F05-A9E0-E82988B26E5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1410C0C9-73AE-4F05-A9E0-E82988B26E5E}.Release|Any CPU.Build.0 = Release|Any CPU - {1A038391-F03B-43DC-BEFF-35DF671DA56C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1A038391-F03B-43DC-BEFF-35DF671DA56C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A038391-F03B-43DC-BEFF-35DF671DA56C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1A038391-F03B-43DC-BEFF-35DF671DA56C}.Release|Any CPU.Build.0 = Release|Any CPU - {0C3EAE6C-05B9-441D-BA48-6262C7B272CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C3EAE6C-05B9-441D-BA48-6262C7B272CC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C3EAE6C-05B9-441D-BA48-6262C7B272CC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C3EAE6C-05B9-441D-BA48-6262C7B272CC}.Release|Any CPU.Build.0 = Release|Any CPU - {83AAFEE0-AA67-4032-87A7-97D312621924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83AAFEE0-AA67-4032-87A7-97D312621924}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83AAFEE0-AA67-4032-87A7-97D312621924}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83AAFEE0-AA67-4032-87A7-97D312621924}.Release|Any CPU.Build.0 = Release|Any CPU - {32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A8F8B0B9-BB92-461F-83C8-04E1DAFCCA55} = {2F3D09B9-7108-4A11-AD4C-D48E8F5BC78D} - {45A81FA3-202D-43AA-8C84-0E69ECA2D0C7} = {A8F8B0B9-BB92-461F-83C8-04E1DAFCCA55} - {1410C0C9-73AE-4F05-A9E0-E82988B26E5E} = {45A81FA3-202D-43AA-8C84-0E69ECA2D0C7} - {FE88649E-2555-4602-BB5B-38ABDDF66E98} = {2F3D09B9-7108-4A11-AD4C-D48E8F5BC78D} - {EE1D6925-D416-4584-AD2A-483EF9C784FB} = {FE88649E-2555-4602-BB5B-38ABDDF66E98} - {A5FB2DC1-4083-4568-B7C8-20538CC7ACB1} = {EE1D6925-D416-4584-AD2A-483EF9C784FB} - {D6D2CECF-CBFC-4FBB-AF11-E45490215BAA} = {A5FB2DC1-4083-4568-B7C8-20538CC7ACB1} - {1A038391-F03B-43DC-BEFF-35DF671DA56C} = {D6D2CECF-CBFC-4FBB-AF11-E45490215BAA} - {0C3EAE6C-05B9-441D-BA48-6262C7B272CC} = {D6D2CECF-CBFC-4FBB-AF11-E45490215BAA} - {83AAFEE0-AA67-4032-87A7-97D312621924} = {D6D2CECF-CBFC-4FBB-AF11-E45490215BAA} - {32D7F16F-0456-4B97-85C4-0CAD7A7DA4AD} = {D6D2CECF-CBFC-4FBB-AF11-E45490215BAA} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {173665FF-417E-4E0A-8980-F84429805C79} - EndGlobalSection -EndGlobal From 95f8cc02c2a10495643eeb7c45c589e0b39c9362 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 14:59:59 -0500 Subject: [PATCH 07/14] tax fix --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 9db77c3dc..fbe662d58 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -18,13 +18,13 @@ The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire You will also need to have the Azure Developer CLI [installed locally](/azure/developer/azure-developer-cli/install-azd). Common install options are as follows: -# [Windows](#tab-windows) +# [Windows](#tab/windows) ```powershell winget install microsoft.azd ``` -# [Mac](#tab-mac) +# [Mac](#tab/mac) ```bash brew tap azure/azd && brew install azd From 4105a8f361d5a2db6236fc0550a7bff6b272e8da Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:01:00 -0500 Subject: [PATCH 08/14] fix images --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index fbe662d58..b0edb651a 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -38,7 +38,7 @@ The `azd init` workflow provides customized supported for .NET Aspire projects. ![Illustration of internal processing of AZD when deploying .NET Aspire application](media/azd-internals.png) -1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file]((../manifest-format.md)). +1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). 1. The manifest file is interrogated by the `provision` sub-command logic to generate Bicep files in-memory only (by default). 1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. 1. Once the underlying Azure resources are configured, the `deploy` sub-command logic is executed which uses the same Aspire manifest file. @@ -76,7 +76,7 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta 1. AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. - ![Screenshot of AZD confirming the detected location of the .NET Aspire application](media/azd-prompt-init-path.png) + ![Screenshot of AZD initially detecting the location of the .NET Aspire application](media/azd-prompt-init-path.png) 1. After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. From 94a2881159bccb747687bdbd917ef0d4bf8a1bed Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:03:17 -0500 Subject: [PATCH 09/14] updates --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index b0edb651a..5b9c186b3 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -46,11 +46,12 @@ The `azd init` workflow provides customized supported for .NET Aspire projects. 1. Once `azd` has built the container images it pushes them to the ACR registry that was created during the provisioning phase. 1. Finally, once the container image is in ACR, `azd` updates the resource using ARM to start using the new version of the container image. -`azd` also enables you to output the generated Bicep to an `infra` folder in your project, which you can read more about in the [Generating Bicep from .NET Aspire app model](/dotnet/aspire/deployment/azure/aca-deployment-azd-in-depth?branch=main#generate-bicep-from-net-aspire-app-model) section. +> [!NOTE] +> `azd` also enables you to output the generated Bicep to an `infra` folder in your project, which you can read more about in the [Generating Bicep from .NET Aspire app model](/dotnet/aspire/deployment/azure/aca-deployment-azd-in-depth?branch=main#generate-bicep-from-net-aspire-app-model) section. ## Provision and deploy a .NET Aspire starter app -The steps ahead demonstrate how to create a .NET Aspire start app and handle provisioning and deploying the app resources to Azure. +The steps in this section demonstrate how to create a .NET Aspire start app and handle provisioning and deploying the app resources to Azure using `azd`. ### Create the .NET Aspire starter app @@ -93,7 +94,7 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta environment name. The environment forms part of an Azure resource-group name when deploying the .NET Aspire application. For now select the name **aspireazddev**. -:::image type="content" source="media/azd-prompt-final.png" lightbox="media/azd-prompt-final.png" alt-text="A screenshot of the final AZD output after initialization."::: + :::image type="content" source="media/azd-prompt-final.png" lightbox="media/azd-prompt-final.png" alt-text="A screenshot of the final AZD output after initialization."::: `azd` generates a number of files and places them into the working directory. These files are: @@ -143,7 +144,7 @@ This file is how AZD remembers (on a per environment basis) which services shoul azd auth login ``` -The previous command will launch a browser to authenticate the command-line session. + The previous command will launch a browser to authenticate the command-line session. 1. Once authenticated use the following command to provision and deploy the application. From de5cd2e0e98e3d764485d2d9b84a547091b38b58 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:11:13 -0500 Subject: [PATCH 10/14] naming fixes --- .../azure/aca-deployment-azd-in-depth.md | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 5b9c186b3..e6b45a475 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -1,12 +1,12 @@ --- -title: Deploy a .NET Aspire app to Azure Container Apps using AZD (in-depth guide) -description: Learn how to use AZD to deploy .NET Aspire apps to Azure Container Apps. +title: Deploy a .NET Aspire app to Azure Container Apps using `azd` (in-depth guide) +description: Learn how to use `azd` to deploy .NET Aspire apps to Azure Container Apps. ms.date: 11/13/2023 --- -# Deploy a .NET Aspire app to Azure Container Apps using AZD (in-depth guide) +# Deploy a .NET Aspire app to Azure Container Apps using`azd`(in-depth guide) -The Azure Developer CLI (AZD) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI and learn the following concepts: +The Azure Developer CLI (`azd`) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI and learn the following concepts: > [!div class="checklist"] > @@ -32,13 +32,13 @@ brew tap azure/azd && brew install azd --- -## How AZD integration works +## How Azure Developer CLI integration works -The `azd init` workflow provides customized supported for .NET Aspire projects. The following diagram illustrates conceptually how this flow works and how AZD and .NET Aspire are integrated: +The `azd init` workflow provides customized supported for .NET Aspire projects. The following diagram illustrates how this flow works conceptually and how `azd` and .NET Aspire are integrated: -![Illustration of internal processing of AZD when deploying .NET Aspire application](media/azd-internals.png) +![Illustration of internal processing of `azd` when deploying .NET Aspire application](media/azd-internals.png) -1. When AZD targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). +1. When `azd` targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). 1. The manifest file is interrogated by the `provision` sub-command logic to generate Bicep files in-memory only (by default). 1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. 1. Once the underlying Azure resources are configured, the `deploy` sub-command logic is executed which uses the same Aspire manifest file. @@ -67,7 +67,7 @@ The previous commands create a new .NET Aspire application based on the `aspire- ### Initialize AZD -Before deploying a .NET Aspire application with `azd`, the repository/path containing the app needs to be initialized. +Before deploying a .NET Aspire application with `azd`, the repository/path containing the app needs to be initialized. 1. Run the following command to initialize your project with `azd`: @@ -75,33 +75,33 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta azd init ``` -1. AZD prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. +1. `azd` prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. - ![Screenshot of AZD initially detecting the location of the .NET Aspire application](media/azd-prompt-init-path.png) + ![Screenshot of `azd` initially detecting the location of the .NET Aspire application](media/azd-prompt-init-path.png) -1. After scanning, AZD prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. +1. After scanning, `azd` prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. - ![Screenshot of AZD confirming the detected location of the .NET Aspire application](media/azd-prompt-confirm-path.png) + ![Screenshot of `azd` confirming the detected location of the .NET Aspire application](media/azd-prompt-confirm-path.png) - Once the path to the AppHost is confirmed AZD will analyze the .NET Aspire app model defined + Once the path to the AppHost is confirmed `azd` will analyze the .NET Aspire app model defined in the AppHost and prompt which of the projects referenced in the app model should be exposed via a public endpoint. For the starter application template only the `webfrontend` should be exposed on a public endpoint. - ![Screenshot of AZD prompting which .NET projects should have public endpoints](media/azd-prompt-select-endpoints.png) + ![Screenshot of `azd` prompting which .NET projects should have public endpoints](media/azd-prompt-select-endpoints.png) -1. The final step in initializing AZD to work with the .NET Aspire code base is to select an +1. The final step in initializing `azd` to work with the .NET Aspire code base is to select an environment name. The environment forms part of an Azure resource-group name when deploying the .NET Aspire application. For now select the name **aspireazddev**. - :::image type="content" source="media/azd-prompt-final.png" lightbox="media/azd-prompt-final.png" alt-text="A screenshot of the final AZD output after initialization."::: + :::image type="content" source="media/azd-prompt-final.png" lightbox="media/azd-prompt-final.png" alt-text="A screenshot of the final `azd` output after initialization."::: `azd` generates a number of files and places them into the working directory. These files are: -- _azure.yaml_: Informs AZD where to find the .NET Aspire AppHost project. -- _.azure/config.json_: Configuration file that informs AZD what the current active environment is. +- _azure.yaml_: Informs `azd` where to find the .NET Aspire AppHost project. +- _.azure/config.json_: Configuration file that informs `azd` what the current active environment is. - _.azure/aspireazddev/.env_: Contains environment specific overrides. -- _.azure/aspireazddev/config.json_: Configuration file that informs AZD which services should have a public endpoint in this environment. +- _.azure/aspireazddev/config.json_: Configuration file that informs `azd` which services should have a public endpoint in this environment. The _azure.yaml_ file has the following contents: @@ -116,7 +116,7 @@ services: host: containerapp ``` -With the `project` field pointing to a .NET Aspire AppHost project, AZD activates its integration with .NET Aspire and derive the required infrastructure needed to host this application from the application model specified in the _Program.cs_ file of the .NET Aspire app. +With the `project` field pointing to a .NET Aspire AppHost project, `azd` activates its integration with .NET Aspire and derive the required infrastructure needed to host this application from the application model specified in the _Program.cs_ file of the .NET Aspire app. The _.azure\aspireazddev\config.json_ file has the following contents: @@ -134,11 +134,11 @@ The _.azure\aspireazddev\config.json_ file has the following contents: } ``` -This file is how AZD remembers (on a per environment basis) which services should be exposed with a public endpoint. AZD can be configured to support multiple environments +This file is how `azd` remembers (on a per environment basis) which services should be exposed with a public endpoint. `azd` can be configured to support multiple environments ### Initial deployment -1. In order to deploy the .NET Aspire application, authenticate to Azure AZD to call the Azure resource management APIs. +1. In order to deploy the .NET Aspire application, authenticate to Azure `azd` to call the Azure resource management APIs. ```azurecli azd auth login @@ -155,9 +155,9 @@ This file is how AZD remembers (on a per environment basis) which services shoul 1. When prompted, select the subscription and location the resources should be deployed to. Once these options are selected the .NET Aspire application will be deployed. - ![Screenshot of AZD output after azd up command is executed](media/azd-up-final.png) + ![Screenshot of `azd` output after azd up command is executed](media/azd-up-final.png) - The final line of output from the AZD command is a link to the Azure Portal that shows + The final line of output from the `azd` command is a link to the Azure Portal that shows all of the Azure resources that were deployed: ![Screenshot of Azure Portal showing deployed resources](media/azd-azure-portal-deployed-resources.png) @@ -168,7 +168,7 @@ Three containers are deployed within this application: - `apiservice`: Contains code from the API service project in the starter template. - `cache`: Running a Redis container image to supply a cache to the front-end. -Just like in local development, the configuration of connection strings has been handled automatically. In this case, AZD was responsible for interpreting the application model and translating it to the appropriate deployment steps. As an example, consider the connection string and service discovery variables that are injected into the `webfrontend` container so that it knows how to connect to the Redis cache and `apiservice`. +Just like in local development, the configuration of connection strings has been handled automatically. In this case, `azd` was responsible for interpreting the application model and translating it to the appropriate deployment steps. As an example, consider the connection string and service discovery variables that are injected into the `webfrontend` container so that it knows how to connect to the Redis cache and `apiservice`. :::image type="content" source="media/azd-aca-variables.png" lightbox="media/azd-aca-variables.png" alt-text="A screenshot of environment variables in the webfrontend container app."::: @@ -179,15 +179,15 @@ For more information on how .NET Aspire apps handle connection strings and servi When the `azd up` command is executed the underlying Azure resources are _provisioned_ and a container image is built and _deployed_ to the container apps hosting the .NET Aspire app. Typically once development is underway and Azure resources are deployed it won't be necessary to provision Azure resources every time code is updated—this is especially true for the developer inner loop. -To speed up deployment of code changes, AZD supports deploying code updates in the container image. This is done using the AZD deploy command: +To speed up deployment of code changes, `azd` supports deploying code updates in the container image. This is done using the `azd` deploy command: ```azdeveloper azd deploy ``` -:::image type="content" source="media/azd-deploy-output.png" lightbox="media/azd-deploy-output.png" alt-text="A screenshot of the AZD deploy command output."::: +:::image type="content" source="media/azd-deploy-output.png" lightbox="media/azd-deploy-output.png" alt-text="A screenshot of the `azd` deploy command output."::: -It's not necessary to deploy all services each time. AZD understands the .NET Aspire app model, it's possible to deploy just one of the services specified using the following command: +It's not necessary to deploy all services each time. `azd` understands the .NET Aspire app model, it's possible to deploy just one of the services specified using the following command: ```azdeveloper azd deploy webfrontend @@ -197,7 +197,7 @@ For more information, see [Azure Developer CLI reference: azd deploy](/azure/dev ### Deploy infrastructure updates -Whenever the dependency structure within a .NET Aspire app changes, AZD will need to re-provision the underlying Azure resources. The `azd provision` command is used to apply these changes to the infrastructure. +Whenever the dependency structure within a .NET Aspire app changes, `azd` must re-provision the underlying Azure resources. The `azd provision` command is used to apply these changes to the infrastructure. To see this in action, update the _Program.cs_ file in the AppHost project to the following: @@ -226,11 +226,11 @@ Save the file and issue the following command: azd provision ``` -The AZD provision command updates the infrastructure by creating a container app to host the Postgres database. The `azd provision` command didn't update the connection strings for the `apiservice` container. In order to have connection strings updated to point to the newly provisioned Postgres database the `azd deploy` command needs to be invoked again. When in doubt, use `azd up` to both provision and deploy. +The `azd provision` command updates the infrastructure by creating a container app to host the Postgres database. The `azd provision` command didn't update the connection strings for the `apiservice` container. In order to have connection strings updated to point to the newly provisioned Postgres database the `azd deploy` command needs to be invoked again. When in doubt, use `azd up` to both provision and deploy. ### Clean up resources -Remember to clean up the Azure resources that you've created during this walkthrough. Because AZD knows the resource group in which it created the resources it can be used to spin down the environment using the following command: +Remember to clean up the Azure resources that you've created during this walkthrough. Because `azd knows the resource group in which it created the resources it can be used to spin down the environment using the following command: ```azdeveloper azd down @@ -423,7 +423,7 @@ After executing the `azd infra synth` command, when `azd provision` and `azd dep ## Isolated environments for debugging -Because AZD makes it easy to provision new environments, it's possible for each team member to have an isolated cloud-hosted environment for debugging code in a setting that closely matches production. When doing this each team member should create their own environment using the following command: +Because `azd` makes it easy to provision new environments, it's possible for each team member to have an isolated cloud-hosted environment for debugging code in a setting that closely matches production. When doing this each team member should create their own environment using the following command: ```azdeveloper azd env new From ceca46a9daa5d0a2dce5b379ebe5b81812f870b9 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:12:05 -0500 Subject: [PATCH 11/14] fix name --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index e6b45a475..4af39742d 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -4,7 +4,7 @@ description: Learn how to use `azd` to deploy .NET Aspire apps to Azure Containe ms.date: 11/13/2023 --- -# Deploy a .NET Aspire app to Azure Container Apps using`azd`(in-depth guide) +# Deploy a .NET Aspire app to Azure Container Apps using the Azure Developer CLI (in-depth guide) The Azure Developer CLI (`azd`) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI and learn the following concepts: From 7b995a92b426c72164367622d103ab74dd1bfb0f Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:44:55 -0500 Subject: [PATCH 12/14] fixes --- .../azure/aca-deployment-azd-in-depth.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 4af39742d..842875416 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -6,7 +6,7 @@ ms.date: 11/13/2023 # Deploy a .NET Aspire app to Azure Container Apps using the Azure Developer CLI (in-depth guide) -The Azure Developer CLI (`azd`) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI and learn the following concepts: +The Azure Developer CLI (`azd`) has been extended to support deploying .NET Aspire applications. Use this guide to walk through the process of creating and deploying a .NET Aspire application to Azure Container Apps using the Azure Developer CLI. In this tutorial, you'll learn the following concepts: > [!div class="checklist"] > @@ -16,7 +16,7 @@ The Azure Developer CLI (`azd`) has been extended to support deploying .NET Aspi [!INCLUDE [aspire-prereqs](../../includes/aspire-prereqs.md)] -You will also need to have the Azure Developer CLI [installed locally](/azure/developer/azure-developer-cli/install-azd). Common install options are as follows: +You will also need to have the Azure Developer CLI [installed locally](/azure/developer/azure-developer-cli/install-azd). Common install options include the following: # [Windows](#tab/windows) @@ -38,10 +38,10 @@ The `azd init` workflow provides customized supported for .NET Aspire projects. ![Illustration of internal processing of `azd` when deploying .NET Aspire application](media/azd-internals.png) -1. When `azd` targets an .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). -1. The manifest file is interrogated by the `provision` sub-command logic to generate Bicep files in-memory only (by default). -1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group providied earlier. -1. Once the underlying Azure resources are configured, the `deploy` sub-command logic is executed which uses the same Aspire manifest file. +1. When `azd` targets a .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). +1. The manifest file is interrogated by the `azd provision` sub-command logic to generate Bicep files in-memory only (by default). +1. After generating the Bicep files, a deployment is triggered using Azure's ARM APIs targetting the subscription and resource group provided earlier. +1. Once the underlying Azure resources are configured, the `azd deploy` sub-command logic is executed which uses the same Aspire manifest file. 1. As part of deployment `azd` makes a call to `dotnet publish` using .NET's built in container publishing support to generate container images. 1. Once `azd` has built the container images it pushes them to the ACR registry that was created during the provisioning phase. 1. Finally, once the container image is in ACR, `azd` updates the resource using ARM to start using the new version of the container image. @@ -55,7 +55,7 @@ The steps in this section demonstrate how to create a .NET Aspire start app and ### Create the .NET Aspire starter app -The first step is to create a new .NET Aspire application. In this example the `dotnet new` command is being used, although you can create the project Visual Studio as well. +Create a new .NET Aspire application using the `dotnet new` command. You can also create the project using Visual Studio. ```dotnetcli dotnet new aspire-starter --use-redis-cache -o AspireAzdWalkthrough @@ -65,7 +65,7 @@ dotnet run --project AspireAzdWalkthrough.AppHost\AspireAzdWalkthrough.AppHost.c The previous commands create a new .NET Aspire application based on the `aspire-starter` template which includes a dependency on Redis cache. It runs the .NET Aspire project which verifies that everything is working correctly. -### Initialize AZD +### Initialize the project Before deploying a .NET Aspire application with `azd`, the repository/path containing the app needs to be initialized. @@ -75,11 +75,11 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta azd init ``` -1. `azd` prompts you on whether you want to use code in the current directory or select a template, in this case select the "Use code in the current directory" option. +1. `azd` prompts you on whether you want to use code in the current directory or select a template. Select the "Use code in the current directory" option. ![Screenshot of `azd` initially detecting the location of the .NET Aspire application](media/azd-prompt-init-path.png) -1. After scanning, `azd` prompts you to confirm that it found the correct .NET project, containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. +1. After scanning, `azd` prompts you to confirm that it found the correct .NET project containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. ![Screenshot of `azd` confirming the detected location of the .NET Aspire application](media/azd-prompt-confirm-path.png) @@ -116,7 +116,7 @@ services: host: containerapp ``` -With the `project` field pointing to a .NET Aspire AppHost project, `azd` activates its integration with .NET Aspire and derive the required infrastructure needed to host this application from the application model specified in the _Program.cs_ file of the .NET Aspire app. +With the `project` field pointing to a .NET Aspire AppHost project, `azd` activates its integration with .NET Aspire and derives the required infrastructure needed to host this application from the application model specified in the _Program.cs_ file of the .NET Aspire app. The _.azure\aspireazddev\config.json_ file has the following contents: @@ -138,15 +138,15 @@ This file is how `azd` remembers (on a per environment basis) which services sho ### Initial deployment -1. In order to deploy the .NET Aspire application, authenticate to Azure `azd` to call the Azure resource management APIs. +1. In order to deploy the .NET Aspire application, authenticate to Azure AD` to call the Azure resource management APIs. ```azurecli azd auth login ``` - The previous command will launch a browser to authenticate the command-line session. + The previous command will launch a browser to authenticate the command-line session. -1. Once authenticated use the following command to provision and deploy the application. +1. Once authenticated, use the following command to provision and deploy the application. ```dotnetcli azd up @@ -166,7 +166,7 @@ Three containers are deployed within this application: - `webfrontend`: Contains code from the web project in the starter template. - `apiservice`: Contains code from the API service project in the starter template. -- `cache`: Running a Redis container image to supply a cache to the front-end. +- `cache`: A Redis container image to supply a cache to the front-end. Just like in local development, the configuration of connection strings has been handled automatically. In this case, `azd` was responsible for interpreting the application model and translating it to the appropriate deployment steps. As an example, consider the connection string and service discovery variables that are injected into the `webfrontend` container so that it knows how to connect to the Redis cache and `apiservice`. @@ -244,7 +244,7 @@ The previous command may take some time to execute, but when completed the resou Although development teams are free to use `azd up` (or `azd provision` and `azd deploy`) commands for their deployments both for development and production purposes, some teams may choose to generate Bicep files that they can review and manage as part of version control (this also allows these Bicep files to be referenced as part of a larger more complex Azure deployment). -AZD includes the ability to output the Bicep it uses for provisioning via following command: +`azd` includes the ability to output the Bicep it uses for provisioning via following command: ```azdeveloper azd config set alpha.infraSynth on From efeb745debce8263c7f9e1cd293ea23b2ce9d8db Mon Sep 17 00:00:00 2001 From: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:49:51 -0500 Subject: [PATCH 13/14] Apply suggestions from code review Co-authored-by: David Pine --- docs/deployment/azure/aca-deployment-azd-in-depth.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 842875416..edd9431f9 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -24,7 +24,7 @@ You will also need to have the Azure Developer CLI [installed locally](/azure/de winget install microsoft.azd ``` -# [Mac](#tab/mac) +# [macOS](#tab/macos) ```bash brew tap azure/azd && brew install azd @@ -71,7 +71,7 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta 1. Run the following command to initialize your project with `azd`: - ```azurecli + ```azdeveloper azd init ``` @@ -140,7 +140,7 @@ This file is how `azd` remembers (on a per environment basis) which services sho 1. In order to deploy the .NET Aspire application, authenticate to Azure AD` to call the Azure resource management APIs. - ```azurecli + ```azdeveloper azd auth login ``` @@ -148,7 +148,7 @@ This file is how `azd` remembers (on a per environment basis) which services sho 1. Once authenticated, use the following command to provision and deploy the application. - ```dotnetcli + ```azdeveloper azd up ``` From 6e6fe880d15dcd7a098dae4e06b0309c6c36bdcc Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 13 Nov 2023 15:58:03 -0500 Subject: [PATCH 14/14] fixed images --- .../azure/aca-deployment-azd-in-depth.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/deployment/azure/aca-deployment-azd-in-depth.md b/docs/deployment/azure/aca-deployment-azd-in-depth.md index 842875416..334abadcf 100644 --- a/docs/deployment/azure/aca-deployment-azd-in-depth.md +++ b/docs/deployment/azure/aca-deployment-azd-in-depth.md @@ -36,7 +36,7 @@ brew tap azure/azd && brew install azd The `azd init` workflow provides customized supported for .NET Aspire projects. The following diagram illustrates how this flow works conceptually and how `azd` and .NET Aspire are integrated: -![Illustration of internal processing of `azd` when deploying .NET Aspire application](media/azd-internals.png) +:::image type="content" source="media/azd-internals.png" alt-text="Illustration of internal processing of `azd` when deploying .NET Aspire application."::: 1. When `azd` targets a .NET Aspire application it starts the AppHost with a special command (`dotnet run --project AppHost.csproj -- --publisher manifest`), which produces the Aspire [manifest file](../manifest-format.md). 1. The manifest file is interrogated by the `azd provision` sub-command logic to generate Bicep files in-memory only (by default). @@ -77,18 +77,18 @@ Before deploying a .NET Aspire application with `azd`, the repository/path conta 1. `azd` prompts you on whether you want to use code in the current directory or select a template. Select the "Use code in the current directory" option. - ![Screenshot of `azd` initially detecting the location of the .NET Aspire application](media/azd-prompt-init-path.png) + :::image type="content" source="media/azd-prompt-init-path.png" alt-text="Screenshot of `azd` initially detecting the location of the .NET Aspire application."::: 1. After scanning, `azd` prompts you to confirm that it found the correct .NET project containing the .NET Aspire app's _AppHost_ code. After checking the path, select the "Confirm and continue initializing my app" option. - ![Screenshot of `azd` confirming the detected location of the .NET Aspire application](media/azd-prompt-confirm-path.png) + :::image type="content" source="media/azd-prompt-confirm-path.png" alt-text="Screenshot of `azd` confirming the detected location of the .NET Aspire application."::: Once the path to the AppHost is confirmed `azd` will analyze the .NET Aspire app model defined in the AppHost and prompt which of the projects referenced in the app model should be exposed via a public endpoint. For the starter application template only the `webfrontend` should be exposed on a public endpoint. - ![Screenshot of `azd` prompting which .NET projects should have public endpoints](media/azd-prompt-select-endpoints.png) + :::image type="content" source="media/azd-prompt-select-endpoints.png" alt-text="Screenshot of `azd` prompting which .NET projects should have public endpoints."::: 1. The final step in initializing `azd` to work with the .NET Aspire code base is to select an environment name. The environment forms part of an Azure resource-group name when deploying @@ -155,12 +155,12 @@ This file is how `azd` remembers (on a per environment basis) which services sho 1. When prompted, select the subscription and location the resources should be deployed to. Once these options are selected the .NET Aspire application will be deployed. - ![Screenshot of `azd` output after azd up command is executed](media/azd-up-final.png) - + :::image type="content" source="media/azd-up-final.png" alt-text="Screenshot of `azd` output after azd up command is executed."::: + The final line of output from the `azd` command is a link to the Azure Portal that shows all of the Azure resources that were deployed: - - ![Screenshot of Azure Portal showing deployed resources](media/azd-azure-portal-deployed-resources.png) + + :::image type="content" source="media/azd-azure-portal-deployed-resources.png" alt-text="Screenshot of Azure Portal showing deployed resources."::: Three containers are deployed within this application: