Skip to content

Commit 589554f

Browse files
authored
Merge pull request #248759 from alexwolfmsft/azd-flow
azd deployment path
2 parents 076d03f + 2ae8e08 commit 589554f

File tree

3 files changed

+127
-4
lines changed

3 files changed

+127
-4
lines changed

articles/app-service/quickstart-dotnetcore.md

Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,26 @@ If you have already installed Visual Studio 2022:
9696

9797
:::zone-end
9898

99+
:::zone target="docs" pivot="development-environment-azd"
100+
101+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/dotnet).
102+
- The [Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd)
103+
- [The latest .NET 7.0 SDK.](https://dotnet.microsoft.com/download/dotnet/7.0)
104+
105+
:::zone-end
106+
107+
:::zone target="docs" pivot="development-environment-vs, development-environment-azure-portal, development-environment-ps, development-environment-vscode, development-environment-cli"
108+
99109
## 1. Create an ASP.NET web app
100110

111+
:::zone-end
112+
113+
:::zone target="docs" pivot="development-environment-azd"
114+
115+
## 1. Initialize the ASP.NET web app template
116+
117+
:::zone-end
118+
101119
:::zone target="docs" pivot="development-environment-vs"
102120

103121
### [.NET 7.0](#tab/net70)
@@ -187,14 +205,38 @@ In this step, you fork a demo project to deploy.
187205
188206
:::zone-end
189207
190-
## 2. Publish your web app
208+
:::zone target="docs" pivot="development-environment-azd"
209+
210+
This quickstart uses the [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) (`azd`) both to create Azure resources and deploy code to it. For more information about Azure Developer CLI, visit the [documentation](/azure/developer/azure-developer-cli/install-azd?tabs=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows) or [training path](/training/paths/azure-developer-cli/).
211+
212+
Retrieve and initialize [the ASP.NET Core web app template](https://github.com/Azure-Samples/quickstart-deploy-aspnet-core-app-service.git) for this quickstart using the following steps:
213+
214+
1. Open a terminal window on your machine to an empty working directory. Initialize the `azd` template using the `azd init` command.
215+
216+
```bash
217+
azd init --template https://github.com/Azure-Samples/quickstart-deploy-aspnet-core-app-service.git
218+
```
219+
When prompted for an environment name, enter `dev`.
220+
221+
2. From the same terminal session, run the application locally using the `dotnet run` command. Use the `--project` parameter to specify the `src` directory of the `azd` template, which is where the application code lives.
222+
223+
```bash
224+
dotnet run --project src --urls=https://localhost:5001/
225+
```
191226
192-
To publish your web app, you must first create and configure a new App Service that you can publish your app to.
227+
3. Open a web browser and navigate to the app at `https://localhost:5001`. The ASP.NET Core 7.0 web app template is displayed on the page.
228+
229+
:::image type="content" source="media/quickstart-dotnetcore/local-web-app-net.png" alt-text="Screenshot of Visual Studio Code - ASP.NET Core 7.0 in local browser." lightbox="media/quickstart-dotnetcore/local-web-app-net.png" border="true":::
230+
231+
:::zone-end
232+
233+
## 2. Publish your web app
193234
194-
As part of setting up the App Service, you create:
235+
The AZD template contains files that will generate the following required resources for your application to run in App service:
195236
196237
- A new [resource group](../azure-resource-manager/management/overview.md#terminology) to contain all of the Azure resources for the service.
197-
- A new [Hosting Plan](overview-hosting-plans.md) that specifies the location, size, and features of the web server farm that hosts your app.
238+
- A new [App Service plan](overview-hosting-plans.md) that specifies the location, size, and features of the web server farm that hosts your app.
239+
- A new [App Service app](overview-hosting-plans.md) instance to run the deployed application.
198240
199241
Follow these steps to create your App Service resources and publish your project:
200242
@@ -483,6 +525,30 @@ Follow these steps to create your App Service resources and publish your project
483525
484526
:::zone-end
485527
528+
:::zone target="docs" pivot="development-environment-azd"
529+
530+
1. Sign into your Azure account by using the az login command and following the prompt:
531+
532+
```bash
533+
azd auth login
534+
```
535+
536+
2. Create the Azure resources and deploy your app using the `azd up` command:
537+
538+
```bash
539+
azd up
540+
```
541+
542+
The `azd up` command might take a few minutes to complete. `azd up` uses the Bicep files in your projects to create the resource group, App Service Plan, and hosting app. It also performs certain configurations such as enabling logging and deploys your compiled app code. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
543+
544+
3. Open a web browser and navigate to the URL:
545+
546+
You see the ASP.NET Core 7.0 web app displayed in the page.
547+
548+
:::image type="content" source="media/quickstart-dotnetcore/browse-dotnet-70.png" lightbox="media/quickstart-dotnetcore/browse-dotnet-70.png" border="true" alt-text="Screenshot of the deployed .NET Framework 4.8 sample app.":::
549+
550+
:::zone-end
551+
486552
## 3. Update the app and redeploy
487553
488554
Follow these steps to update and redeploy your web app:
@@ -709,6 +775,34 @@ You see the updated ASP.NET Core 7.0 web app displayed in the page.
709775
710776
:::zone-end
711777
778+
779+
<!-- markdownlint-disable MD044 -->
780+
:::zone target="docs" pivot="development-environment-azd"
781+
<!-- markdownlint-enable MD044 -->
782+
783+
In the local directory, open the *Index.cshtml* file. Replace the first `<div>` element:
784+
785+
```razor
786+
<div class="jumbotron">
787+
<h1>.NET 💜 Azure</h1>
788+
<p class="lead">Example .NET app to Azure App Service.</p>
789+
</div>
790+
```
791+
792+
Save your changes, then redeploy the app using the `azd up` command again:
793+
794+
```azurecli
795+
azd up
796+
```
797+
798+
`azd up` will skip the provisioning resources step this time and only redeploy your code, since there have been no changes to the Bicep files.
799+
800+
Once deployment has completed, the browser will open to the updated ASP.NET Core 7.0 web app.
801+
802+
:::image type="content" source="media/quickstart-dotnetcore/updated-azure-web-app-net.png" lightbox="media/quickstart-dotnetcore/updated-azure-web-app-net.png" border="true" alt-text="Screenshot of the CLI - Updated ASP.NET Core 7.0 web app in Azure.":::
803+
804+
:::zone-end
805+
712806
## 4. Manage the Azure app
713807

714808
To manage your web app, go to the [Azure portal](https://portal.azure.com), and search for and select **App Services**.
@@ -752,6 +846,12 @@ The **Overview** page for your web app, contains options for basic management li
752846
:::zone-end
753847
<!-- markdownlint-enable MD044 -->
754848

849+
:::zone target="docs" pivot="development-environment-azd"
850+
<!-- markdownlint-enable MD044 -->
851+
[!INCLUDE [Clean-up Azure Developer CLI web app resources](../../includes/clean-up-section-azure-developer-cli.md)]
852+
:::zone-end
853+
<!-- markdownlint-enable MD044 -->
854+
755855
## Next steps
756856

757857
### [.NET 7.0](#tab/net70)
@@ -767,6 +867,11 @@ Advance to the next article to learn how to create a .NET Core app and connect i
767867
> [!div class="nextstepaction"]
768868
> [Configure ASP.NET Core app](configure-language-dotnetcore.md)
769869
870+
:::zone target="docs" pivot="development-environment-azd"
871+
> [!div class="nextstepaction"]
872+
> [Learn more about the Azure Developer CLI](/azure/developer/azure-developer-cli/overview)
873+
:::zone-end
874+
770875
### [.NET Framework 4.8](#tab/netframework48)
771876

772877
Advance to the next article to learn how to create a .NET Framework app and connect it to a SQL Database:

articles/zone-pivot-groups.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,8 @@ groups:
10921092
title: Azure PowerShell
10931093
- id: development-environment-azure-portal
10941094
title: Azure portal
1095+
- id: development-environment-azd
1096+
title: Azure Developer CLI
10951097
- id: app-service-ide-oss
10961098
title: Development environment
10971099
prompt: Choose a development environment
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
ms.topic: include
3+
ms.date: 09/05/2023
4+
author: alexwolfmsft
5+
ms.author: alexwolf
6+
---
7+
## Clean up resources
8+
9+
Use the `azd down` command to remove the resource group and all resources associated with it:
10+
11+
```bash
12+
azd down
13+
```
14+
15+
Visit the [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) documentation for next steps on working with `azd` templates and additional features.
16+

0 commit comments

Comments
 (0)