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
Copy file name to clipboardExpand all lines: articles/python/sdk/examples/azure-sdk-example-web-app.md
+18-10
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Create and deploy a Python web app to Azure App Service using the Azure SDK libraries
3
3
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
5
5
ms.topic: conceptual
6
6
ms.custom: devx-track-python, py-fresh-zinc
7
7
---
@@ -12,8 +12,6 @@ This example demonstrates how to use the Azure SDK *management* libraries in a P
12
12
13
13
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.)
14
14
15
-
All the commands in this article work the same in Linux/macOS bash and Windows command shells unless noted.
16
-
17
15
## 1: Set up your local development environment
18
16
19
17
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:
28
26
29
27
In a terminal or command prompt with the virtual environment activated, install the requirements:
30
28
31
-
```cmd
29
+
```console
32
30
pip install -r requirements.txt
33
31
```
34
32
@@ -54,6 +52,13 @@ REPO_URL=<url_of_your_fork>
54
52
AZURE_SUBSCRIPTION_ID=<subscription_id>
55
53
```
56
54
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
+
57
62
---
58
63
59
64
## 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
Visit the deployed web site by running the following command:
82
87
83
88
```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
85
90
```
86
91
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.
88
93
89
94
If you don't see the expected output, wait a few minutes and try again.
90
95
@@ -106,18 +111,18 @@ You can deploy your code with the Azure CLI by running the [az webapp deployment
106
111
command:
107
112
108
113
```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
110
115
```
111
116
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.
113
118
114
119
To deploy your code from Azure portal:
115
120
116
121
1. Go to the [Azure portal](https://portal.azure.com).
117
122
1. Select **Resource groups**, and find the resource group you created.
118
123
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.
119
124
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
121
126
122
127
## 8: Clean up resources
123
128
@@ -141,6 +146,9 @@ The following Azure CLI commands complete the same provisioning steps as the Pyt
0 commit comments