Edit

Share via


Identity and access management for Python apps on Azure

In Azure, identity and access management (IAM) for Python applications involves two key concepts:

  • Authentication: Verifying the identity of a user, group, service, or application
  • Authorization: Determining what actions that identity is allowed to perform on Azure resources

Azure provides multiple IAM options to fit your application's security requirements. This article includes links to essential resources to help you get started.

To learn more, see Recommendations for identity and access management.

Passwordless connections

Whenever possible, we recommend using managed identities to simplify identity management and enhance security. Managed identities support passwordless authentication, eliminating the need to embed sensitive credentials—such as passwords or client secrets—in code or environment variables. Managed identities are available for Azure services like App Service, Azure Functions, and Azure Container Apps. They allow your applications to authenticate to Azure services without needing to manage credentials.

The following resources demonstrate how to use the Azure SDK for Python with passwordless authentication via DefaultAzureCredential. DefaultAzureCredential is ideal for most applications running in Azure, as it seamlessly supports both local development and production environments by chaining multiple credential types in a secure and intelligent order.

Service Connector

Many Azure resources commonly used in Python applications support the Service Connector. The Service Connector streamlines the process of configuring secure connections between Azure services. It automates the setup of authentication, network access, and connection strings between compute services (like App Service or Container Apps) and dependent services (such as Azure Storage, Azure SQL, or Cosmos DB). This reduces manual steps, helps enforce best practices (like using managed identities and private endpoints), and improves deployment consistency and security.

Key Vault

Using a key management solution such as Azure Key Vault offers greater control over your secrets and credentials, though it comes with added management complexity.

Authentication and identity for signing in users in apps

You can develop Python applications that allow users to sign in with Microsoft identities (like Azure AD accounts) or external social accounts (such as Google or Facebook). Once authenticated, your app can authorize users to access its own APIs or Microsoft APIs, such as Microsoft Graph, to interact with resources like user profiles, calendars, and emails.