You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
+
```
191
226
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
193
234
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:
195
236
196
237
- 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.
198
240
199
241
Follow these steps to create your App Service resources and publish your project:
200
242
@@ -483,6 +525,30 @@ Follow these steps to create your App Service resources and publish your project
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
+
486
552
## 3. Update the app and redeploy
487
553
488
554
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.
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
+
712
806
## 4. Manage the Azure app
713
807
714
808
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
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.
0 commit comments