In this hands-on tutorial, we dive deep into Azure Managed Identity and learn how to securely access Azure Key Vault from a Python application without managing a single client secret or password.
Managing credentials in .env files or environment variables is a security risk in production. Azure Managed Identity solves this by providing an identity for your Azure resources (like Container Instances or VMs) to authenticate to other services.
What you will learn:
✅ The difference between System-assigned and User-assigned Managed Identities.
✅ How to use the azure-identity Python SDK and DefaultAzureCredential.
✅ Setting up an Azure Key Vault with Role-Based Access Control (RBAC).
✅ Building and deploying a Dockerized Python app to Azure Container Registry (ACR).
✅ Running the app on Azure Container Instances (ACI) with a secure identity.
Chapters :
***********************************************************
0:00 Introduction: The Problem with Hardcoded Secrets
0:32 What is Azure Managed Identity?
1:05 System-assigned vs. User-assigned Identities
2:58 Python Code: Switching to DefaultAzureCredential
4:00 Setting up the Resource Group & Key Vault
5:20 Creating Secrets & Configuring RBAC Permissions
6:01 Creating the Azure Container Registry (ACR)
6:40 Building the Docker Image via Azure Cloud Shell
8:39 Deploying to Azure Container Instance (ACI)
9:10 Enabling Admin User for ACR Image Pull
10:45 Enabling System-assigned Managed Identity on ACI
11:40 Granting Key Vault Access to the Managed Identity
13:20 Testing the Secure Connection: Fetching Secrets
Access Key Vault using Service Principal from Local :
***********************************************************
• 01. Azure using Python SDK : Retrieve your...
Refer the code here :
**********************************************************
https://github.com/PraveenKS30/Access...
Follow me on X : https://x.com/PraveenKS30
Interested to learn more, check these playlists :
*********************************************************
Google's ADK Series : • Getting started with Google's ADK !
OpenAI Agent SDK Series : • Getting started with OpenAI Agents SDK !
Spring AI Tutorials : Generative AI for Java Developers : • Spring AI Tutorials : Generative AI for J...
Gen AI using Open Source Models : • Gen AI using Open Source Models !
Generative AI using Native APIs : • Generative AI using OpenAI API !
Getting Started with Azure AI Services : • Getting Started with Azure AI Foundary !