Skip to content

Commit 1b79e4b

Browse files
committed
259636
1 parent 59698ae commit 1b79e4b

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

articles/python/sdk/examples/azure-sdk-example-web-app.md

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create and deploy a Python web app to Azure App Service using the Azure SDK libraries
33
description: Use Azure SDK for Python to create a web app and then deploy app code from a GitHub repository to Azure App Service.
4-
ms.date: 12/28/2023
4+
ms.date: 04/15/2025
55
ms.topic: conceptual
66
ms.custom: devx-track-python, py-fresh-zinc
77
---
@@ -12,8 +12,6 @@ This example demonstrates how to use the Azure SDK *management* libraries in a P
1212

1313
With the management libraries (namespaces beginning with `azure-mgmt`, for example, `azure-mgmt-web`), you can write configuration and deployment programs to perform the same tasks that you can through the Azure portal, Azure CLI, or other resource management tools. For examples, see [Quickstart: Deploy a Python (Django or Flask) web app to Azure App Service](/azure/app-service/quickstart-python). ([Equivalent Azure CLI commands](#for-reference-equivalent-azure-cli-commands) are given at later in this article.)
1414

15-
All the commands in this article work the same in Linux/macOS bash and Windows command shells unless noted.
16-
1715
## 1: Set up your local development environment
1816

1917
If you haven't already, set up an environment where you can run this code. Here are some options:
@@ -28,7 +26,7 @@ Create a file named *requirements.txt* with the following contents:
2826

2927
In a terminal or command prompt with the virtual environment activated, install the requirements:
3028

31-
```cmd
29+
```console
3230
pip install -r requirements.txt
3331
```
3432

@@ -54,6 +52,13 @@ REPO_URL=<url_of_your_fork>
5452
AZURE_SUBSCRIPTION_ID=<subscription_id>
5553
```
5654

55+
# [powershell](#tab/powershell)
56+
57+
```powershell
58+
$REPO_URL=<url_of_your_fork>
59+
AZURE_SUBSCRIPTION_ID='<subscription_id>' #use single quotes to avoid interpolation
60+
```
61+
5762
---
5863

5964
## 4: Write code to create and deploy a web app
@@ -72,7 +77,7 @@ Create a Python file named *provision_deploy_web_app.py* with the following code
7277

7378
## 5: Run the script
7479

75-
```cmd
80+
```console
7681
python provision_deploy_web_app.py
7782
```
7883

@@ -81,10 +86,10 @@ python provision_deploy_web_app.py
8186
Visit the deployed web site by running the following command:
8287

8388
```azurecli
84-
az webapp browse --name PythonAzureExample-WebApp-12345 --resource-group PythonAzureExample-WebApp-rg
89+
az webapp browse --name <PythonAzureExample-WebApp-12345> --resource-group PythonAzureExample-WebApp-rg
8590
```
8691

87-
Replace the web app name (`--name` option) and resource group name (`--resource-group` option) with the values you used in the script. You should see "Hello, World!" in the browser.
92+
Replace the web app name (`--name` option) with the value generated in the script. You do not need to change resource group name (`--resource-group` option) unless you changed the value in the script. You should see "Hello, World!" in the browser.
8893

8994
If you don't see the expected output, wait a few minutes and try again.
9095

@@ -106,18 +111,18 @@ You can deploy your code with the Azure CLI by running the [az webapp deployment
106111
command:
107112

108113
```azurecli
109-
az webapp deployment source sync --name PythonAzureExample-WebApp-12345 --resource-group PythonAzureExample-WebApp-rg
114+
az webapp deployment source sync --name <PythonAzureExample-WebApp-12345> --resource-group PythonAzureExample-WebApp-rg
110115
```
111116

112-
Replace the web app name (`--name` option) and resource group name (`--resource-group` option) with the values you used in the script.
117+
Replace the web app name (`--name` option) with the value generated in the script. You do not need to change resource group name (`--resource-group` option) unless you changed the value in the script.
113118

114119
To deploy your code from Azure portal:
115120

116121
1. Go to the [Azure portal](https://portal.azure.com).
117122
1. Select **Resource groups**, and find the resource group you created.
118123
1. Select the resource group name to view the resources it contains. Specifically, verify that there's an App Service Plan and the App Service.
119124
1. Select the App Service, and then select **Deployment Center**.
120-
1. On the top menu, select **Sync** to deploy your code.
125+
1. On the top menu, select **Sync** to deploy your code
121126

122127
## 8: Clean up resources
123128

@@ -141,6 +146,9 @@ The following Azure CLI commands complete the same provisioning steps as the Pyt
141146

142147
:::code language="azurecli" source="~/../python-sdk-docs-examples/webapp/provision.sh":::
143148

149+
# [powershell](#tab/powershell)
150+
:::code language="azurecli" source="~/../python-sdk-docs-examples/webapp/provision.ps1":::
151+
144152
---
145153

146154
## See also

0 commit comments

Comments
 (0)