Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

Get started with Python on Azure

  • 2025-01-28
Feedback

In this article

If you're new to developing applications for the cloud, this short series of 8 articles is the best place to start.

Create an Azure Account

To develop Python applications with Azure, you need an Azure account. Your Azure account is the credentials you use to sign-in to Azure with and what you use to create Azure resources.

If you're using Azure at work, talk to your company's cloud administrator to get your credentials used to sign-in to Azure.

Otherwise, you can create anAzure account for free and receive 12 months of popular services for free and a $200 credit to explore Azure for 30 days.

Create and manage resources

To use Azure resources like databases, message queues, file storage, and so on, you must first create an instance of the resource. Creating resources involves:

  • choosing capacity or computing options
  • adding the new resource to a resource group
  • selecting the region of the world where the service runs
  • giving the service a unique name

There are several tools you can use to create and manage Azure resources, depending on your scenario:

  • Azure portal - If you're new to Azure and want a web-based user interface to create and manage a couple of resources.
  • Azure CLI - If you're more comfortable with command line interfaces.
  • Azure PowerShell - If you prefer a PowerShell style syntax in their CLI.
  • Azure Developer CLI - When you want to create repeatable deployments involving many Azure resources with intricate dependencies. Requires learning Bicep templates.
  • Azure Tools extension pack - The extension pack contains extensions for working with some of the most popular Azure services in one convenient package.

You can also use theAzure Management Libraries for Python to create and manage resources. The management libraries allow you to use Python to implement custom deployment and management functionality. Here are a few articles that can help you get started:

Write your Python app

Developing on Azure requiresPython 3.8 or higher. To verify the version of Python on your workstation, in a console window type the commandpython3 --version for macOS/Linux orpy --version for Windows.

Use your favorite tools to write your Python app. If you use Visual Studio Code, you should try thePython extension for Visual Studio Code.

Most of the instructions in this set of articles use a virtual environment because it's a best practice. Feel free to use any virtual environment you want, but the article instructions standardize onvenv.

Use client libraries

As you're getting started, the articles instruct you on which Python on Azure libraries to install and reference using thepip utility.

At some point, you might want toinstall and reference theAzure SDK for Python client libraries without having to follow the instructions in an article. TheAzure SDK Overview is a great starting point.

Authenticate your app to Azure

When you use the Azure SDK for Python, you must add authentication logic to your app. How your app authenticates depends on whether you're running your app locally during development and testing, hosting the app on your own servers, or hosting the app in Azure. ReadAuthenticate Python apps to Azure services by using the Azure SDK for Python to understand more about authentication on Azure.

You'll also need to set up access policies that control what identities (service principals and/or application IDs) are able to access those resources. Access policies are managed through AzureRole-Based Access Control (RBAC); some services have more specific access controls as well. As a cloud developer working with Azure, make sure to familiarize yourself with Azure RBAC because you use it with just about any resource that has security concerns.

Add cross-cutting concerns

Host your Python app

If you want your app code to run on Azure, you have several options as described inHosting applications on Azure.

If you're building web apps or APIs (Django, Flask, FastAPI, and so on), consider:

If you're building a web application, seeConfigure your local environment for deploying Python web apps on Azure.

Also, if you're building a web API, you should consider usingAzure API Management.

If you're building back-end processes:

Next steps


Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo