SlideShare a Scribd company logo
1 of 18
Secure Azure Services using AD
Authentication
Udaiappa Ramachandran ( Udai )
https://udai.io
About me
• Udaiappa Ramachandran ( Udai )
• CTO/CSO-Akumina, Inc.
• Microsoft Azure MVP
• Cloud Expert
• Microsoft Azure, Amazon Web Services, and Google
• New Hampshire Cloud User Group (http://www.meetup.com/nashuaug )
• https://udai.io
Agenda
• Introduction
• Managed Identity, User Managed Identty, and Service Principal
• RBAC
• Local Auth Mode
• Securing Services using AD Auth
• Demo…Demo…Demo…
RBAC Why?
• The Problem:
• Connecting to services requires knowing the key
• Key vault is secure, but is one more secret to manage
• Key rotation is more complicated because it needs to be synced with key vault
• Keys are all-or-nothing; if the key leaks, any caller can use it, unless your services are guard railed by
private network/private link
• The Solution:
• RBAC access removes the need to store any key in key vault
• Key rotation does not need because no key is even used
• Key access can be disabled entirely so even if the key is leaked, it is not usable
• Fine-grained control can be granted on an app-by-app basis
• Caveats:
• Not everything can be managed in portal; may need command line tools (ex., local auth for
CosmosDB)
• ComsosDB data explorer in azure portal requires key be enabled to function properly
• Cosmos Emulator does not support RBAC; must connect with key
Managed Identity
• Automatically managed by Azure.
• Scoped to a particular Azure resource.
• Useful when an application running on that resource needs to access other Azure
resources securely.
• Simplifies authentication and avoids the need to handle and store credentials
within the application's code.
User-Assigned Managed Identity
• Manually created by you.
• Separated from any specific resource, making it more flexible and reusable.
• Suitable when you want to share the same identity across multiple resources,
enabling central management of access.
• Offers better control over the lifecycle of the identity, allowing you to manage it
independently from the lifecycle of the resources it's used with.
Service Principal
• It's typically used when an application or script needs to access Azure
resources from outside of Azure (like a CI/CD pipeline).
• It can have different levels of access (roles/permissions) depending on what
it needs to do.
• It's manually created and managed by an Azure AD administrator.
• It's often used for long-running processes or automation tasks.
Sample Flow
Managed Identity Flow
1.An Azure resource (e.g., Virtual Machine) with a Managed Identity needs to
access another Azure service (e.g., Azure Key Vault).
2.The application running on the Azure resource sends a request to access the
target Azure service.
3.The Azure resource's Managed Identity sends an authentication request to
Azure Active Directory (Azure AD) automatically.
4.Azure AD validates the Managed Identity's request and provides an access
token to the Managed Identity.
5.The Managed Identity uses the received token to authenticate with the target
Azure service.
6.The target Azure service validates the token and, if authorized, allows the
Managed Identity to access the service's resources.
User-Assigned Managed Identity Flow
1.You create a User-Assigned Managed Identity in Azure.
2.You assign the User-Assigned Managed Identity to one or more Azure
resources (e.g., Virtual Machines, Azure Functions).
3.The application running on one of the assigned resources sends a request to
access an Azure service.
4.The User-Assigned Managed Identity associated with the resource sends an
authentication request to Azure AD.
5.Azure AD validates the Managed Identity's request and provides an access
token to the Managed Identity.
6.The Managed Identity uses the token to authenticate with the target Azure
service.
7.The target Azure service validates the token and, if authorized, allows the
Managed Identity to access the service's resources.
Service Principal Flow
1.An external application (e.g., a CI/CD pipeline) needs to interact with Azure
services.
2.The external application uses a Service Principal's credentials (client ID and
client secret) to request an access token from Azure AD.
3.Azure AD validates the Service Principal's credentials and provides an
access token to the application.
4.The application uses the received token to authenticate with the target Azure
service.
5.The target Azure service validates the token and, if authorized, allows the
application (through the Service Principal) to access the service's resources.
TokenCredential
var defaultTokenCredential = new DefaultAzureCredential();
var systemManagedTokenCredential = new ManagedIdentityCredential();
var userManagedTokenCredential = new ManagedIdentityCredential("[clientId]");
var spTokenCredential = new ClientSecretCredential("[TenantId]", "[clientId]","[clientSecret]");
Azure service that supports AAD authentication
• API Management
• Azure App Configuration
• Azure App Services
• Azure Batch
• Azure Container Registry
• Azure Cognitive Services
• Azure Communication Services
• Azure Cosmos DB
• Azure Databricks
• Azure Data Explorer
• Azure Data Lake Storage Gen1
• Azure Database for PostgreSQL
• Azure Digital Twins
• Azure Event Hubs
• Azure IoT Hub
• Azure Key Vault
• Azure Kubernetes Service (AKS)
• Azure Machine Learning Services
• Azure Maps
• Azure Media services
• Azure Monitor
• Azure Resource Manager
• Azure Service Fabric
• Azure Service Bus
• Azure SignalR Service
• Azure SQL
Azure Managed Instance
• Azure Static Web Apps
• Azure Storage
• Azure Virtual Machines
https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-id-
authentication-support
Demo
• Key vault
• App Insight – local auth disabled
• Cosmos DB – local auth disabled and keyless
• Azure Storage (Blob, Table, Queue, Files)
• Etc.,
CosmosDB – Disabling LocalAuth, R/W access
$subscriptionId="[YOUR SUBSCRIPTION ID]"
$cosmosDbAccountName = "[YOUR COSMOS ACCOUNT NAME]"
$resourceGroupName = "[YOUR RESOURCE GROUP]"
$objectId="[YOUR OBJECT ID]"
$roleName="[YOUR CUSTOM ROLE NAME]"
az account set --subscription $subscriptionId
$cosmosdb = az cosmosdb show --name $cosmosDBAccountName --resource-group
$resourceGroupName | ConvertFrom-Json
#Disable Local Auth
az resource update --ids $cosmosdb.id --set properties.disableLocalAuth=true
#For Built-in Data Read/Write
$roleDefId= '00000000-0000-0000-0000-000000000002' #001 -readonly #002-
read/write
az cosmosdb sql role assignment create --account-name $cosmosDbAccountName -
-resource-group $resourceGroupName --role-definition-id $roleDefId --
principal-id $objectId --scope "/"
Application Insight
• Disable Enable Local auth from Overview
• Give “Monitoring Metrics Publisher” permissions from Access Control section of the App Insight.
Reference
• https://learn.microsoft.com/en-us/azure/app-service/tutorial-connect-msi-sql-
database?WT.mc_id=AZ-MVP-5004665
• https://learn.microsoft.com/en-us/azure/azure-monitor/app/azure-ad-
authentication?WT.mc_id=AZ-MVP-5004665
• https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-
rbac#permission-model?WT.mc_id=AZ-MVP-5004665
Thanks for your time and trust!
New Hampshire CLOUD .NET User Group

More Related Content

Similar to SecureAzureServicesUsingADAuthentication.pptx

Passwordless Development using Azure Identity
Passwordless Development using Azure IdentityPasswordless Development using Azure Identity
Passwordless Development using Azure IdentitySarah Dutkiewicz
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesJoonas Westlin
 
Tour to Azure Security Center
Tour to Azure Security CenterTour to Azure Security Center
Tour to Azure Security CenterLalit Rawat
 
Configuration in azure done right
Configuration in azure done rightConfiguration in azure done right
Configuration in azure done rightRick van den Bosch
 
Introduction to basic governance in Azure - #GABDK
Introduction to basic governance in Azure - #GABDKIntroduction to basic governance in Azure - #GABDK
Introduction to basic governance in Azure - #GABDKPeter Selch Dahl
 
Azure - Identity as a service
Azure - Identity as a serviceAzure - Identity as a service
Azure - Identity as a serviceBizTalk360
 
Azure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish KalamatiAzure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish KalamatiGirish Kalamati
 
Cloud computing & windows azure intro
Cloud computing & windows azure introCloud computing & windows azure intro
Cloud computing & windows azure introHaddy El-Haggan
 
Tokyo azure meetup #8 azure update, august
Tokyo azure meetup #8   azure update, augustTokyo azure meetup #8   azure update, august
Tokyo azure meetup #8 azure update, augustTokyo Azure Meetup
 
Tokyo azure meetup #8 - Azure Update, August
Tokyo azure meetup #8 - Azure Update, AugustTokyo azure meetup #8 - Azure Update, August
Tokyo azure meetup #8 - Azure Update, AugustKanio Dimitrov
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2Rodrigo Cândido da Silva
 
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environmentDEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environmentFelipe Prado
 
Introduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CIntroduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CJoonas Westlin
 
Using Windows Azure for Solving Identity Management Challenges
Using Windows Azure for Solving Identity Management ChallengesUsing Windows Azure for Solving Identity Management Challenges
Using Windows Azure for Solving Identity Management ChallengesMichael Collier
 
IglooConf 2019 Secure your Azure applications like a pro
IglooConf 2019 Secure your Azure applications like a proIglooConf 2019 Secure your Azure applications like a pro
IglooConf 2019 Secure your Azure applications like a proKarl Ots
 
Aws security best practices
Aws security best practicesAws security best practices
Aws security best practicesSundeep Roxx
 
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018Easy Auth Overview - Tokyo Azure Meetup - Feb 2018
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018Chris Gillum
 

Similar to SecureAzureServicesUsingADAuthentication.pptx (20)

Passwordless Development using Azure Identity
Passwordless Development using Azure IdentityPasswordless Development using Azure Identity
Passwordless Development using Azure Identity
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed Identities
 
Tour to Azure Security Center
Tour to Azure Security CenterTour to Azure Security Center
Tour to Azure Security Center
 
Configuration in azure done right
Configuration in azure done rightConfiguration in azure done right
Configuration in azure done right
 
Introduction to basic governance in Azure - #GABDK
Introduction to basic governance in Azure - #GABDKIntroduction to basic governance in Azure - #GABDK
Introduction to basic governance in Azure - #GABDK
 
Azure - Identity as a service
Azure - Identity as a serviceAzure - Identity as a service
Azure - Identity as a service
 
Azure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish KalamatiAzure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish Kalamati
 
Understanding Azure AD
Understanding Azure ADUnderstanding Azure AD
Understanding Azure AD
 
Cloud computing & windows azure intro
Cloud computing & windows azure introCloud computing & windows azure intro
Cloud computing & windows azure intro
 
Tokyo azure meetup #8 azure update, august
Tokyo azure meetup #8   azure update, augustTokyo azure meetup #8   azure update, august
Tokyo azure meetup #8 azure update, august
 
Tokyo azure meetup #8 - Azure Update, August
Tokyo azure meetup #8 - Azure Update, AugustTokyo azure meetup #8 - Azure Update, August
Tokyo azure meetup #8 - Azure Update, August
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2
 
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environmentDEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
 
Introduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CIntroduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2C
 
Microservices in Azure
Microservices in AzureMicroservices in Azure
Microservices in Azure
 
Using Windows Azure for Solving Identity Management Challenges
Using Windows Azure for Solving Identity Management ChallengesUsing Windows Azure for Solving Identity Management Challenges
Using Windows Azure for Solving Identity Management Challenges
 
What is Azure.pptx
What is Azure.pptxWhat is Azure.pptx
What is Azure.pptx
 
IglooConf 2019 Secure your Azure applications like a pro
IglooConf 2019 Secure your Azure applications like a proIglooConf 2019 Secure your Azure applications like a pro
IglooConf 2019 Secure your Azure applications like a pro
 
Aws security best practices
Aws security best practicesAws security best practices
Aws security best practices
 
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018Easy Auth Overview - Tokyo Azure Meetup - Feb 2018
Easy Auth Overview - Tokyo Azure Meetup - Feb 2018
 

More from Udaiappa Ramachandran

More from Udaiappa Ramachandran (20)

RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
Level up your security using Intune.pptx
Level up your security using Intune.pptxLevel up your security using Intune.pptx
Level up your security using Intune.pptx
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
AI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptxAI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptx
 
DOTNET8.pptx
DOTNET8.pptxDOTNET8.pptx
DOTNET8.pptx
 
AzureSynapse.pptx
AzureSynapse.pptxAzureSynapse.pptx
AzureSynapse.pptx
 
Vector Search using OpenAI in Azure Cognitive Search.pptx
Vector Search using OpenAI in Azure Cognitive Search.pptxVector Search using OpenAI in Azure Cognitive Search.pptx
Vector Search using OpenAI in Azure Cognitive Search.pptx
 
AzureOpenAI.pptx
AzureOpenAI.pptxAzureOpenAI.pptx
AzureOpenAI.pptx
 
OpenAI-Copilot-ChatGPT.pptx
OpenAI-Copilot-ChatGPT.pptxOpenAI-Copilot-ChatGPT.pptx
OpenAI-Copilot-ChatGPT.pptx
 
DiagnoseAndSolveproblems.pptx
DiagnoseAndSolveproblems.pptxDiagnoseAndSolveproblems.pptx
DiagnoseAndSolveproblems.pptx
 
MAUI.pptx
MAUI.pptxMAUI.pptx
MAUI.pptx
 
CosmosDB.pptx
CosmosDB.pptxCosmosDB.pptx
CosmosDB.pptx
 
.NET7.pptx
.NET7.pptx.NET7.pptx
.NET7.pptx
 
AzureDevOps
AzureDevOpsAzureDevOps
AzureDevOps
 
AzureCostManagementAndBilling
AzureCostManagementAndBillingAzureCostManagementAndBilling
AzureCostManagementAndBilling
 
.NET6.pptx
.NET6.pptx.NET6.pptx
.NET6.pptx
 
Azure Automation and Update Management
Azure Automation and Update ManagementAzure Automation and Update Management
Azure Automation and Update Management
 
Azure staticwebapps
Azure staticwebappsAzure staticwebapps
Azure staticwebapps
 
Azure privatelink
Azure privatelinkAzure privatelink
Azure privatelink
 
Azure Security Center
Azure Security CenterAzure Security Center
Azure Security Center
 

Recently uploaded

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

SecureAzureServicesUsingADAuthentication.pptx

  • 1. Secure Azure Services using AD Authentication Udaiappa Ramachandran ( Udai ) https://udai.io
  • 2. About me • Udaiappa Ramachandran ( Udai ) • CTO/CSO-Akumina, Inc. • Microsoft Azure MVP • Cloud Expert • Microsoft Azure, Amazon Web Services, and Google • New Hampshire Cloud User Group (http://www.meetup.com/nashuaug ) • https://udai.io
  • 3. Agenda • Introduction • Managed Identity, User Managed Identty, and Service Principal • RBAC • Local Auth Mode • Securing Services using AD Auth • Demo…Demo…Demo…
  • 4. RBAC Why? • The Problem: • Connecting to services requires knowing the key • Key vault is secure, but is one more secret to manage • Key rotation is more complicated because it needs to be synced with key vault • Keys are all-or-nothing; if the key leaks, any caller can use it, unless your services are guard railed by private network/private link • The Solution: • RBAC access removes the need to store any key in key vault • Key rotation does not need because no key is even used • Key access can be disabled entirely so even if the key is leaked, it is not usable • Fine-grained control can be granted on an app-by-app basis • Caveats: • Not everything can be managed in portal; may need command line tools (ex., local auth for CosmosDB) • ComsosDB data explorer in azure portal requires key be enabled to function properly • Cosmos Emulator does not support RBAC; must connect with key
  • 5. Managed Identity • Automatically managed by Azure. • Scoped to a particular Azure resource. • Useful when an application running on that resource needs to access other Azure resources securely. • Simplifies authentication and avoids the need to handle and store credentials within the application's code.
  • 6. User-Assigned Managed Identity • Manually created by you. • Separated from any specific resource, making it more flexible and reusable. • Suitable when you want to share the same identity across multiple resources, enabling central management of access. • Offers better control over the lifecycle of the identity, allowing you to manage it independently from the lifecycle of the resources it's used with.
  • 7. Service Principal • It's typically used when an application or script needs to access Azure resources from outside of Azure (like a CI/CD pipeline). • It can have different levels of access (roles/permissions) depending on what it needs to do. • It's manually created and managed by an Azure AD administrator. • It's often used for long-running processes or automation tasks.
  • 9. Managed Identity Flow 1.An Azure resource (e.g., Virtual Machine) with a Managed Identity needs to access another Azure service (e.g., Azure Key Vault). 2.The application running on the Azure resource sends a request to access the target Azure service. 3.The Azure resource's Managed Identity sends an authentication request to Azure Active Directory (Azure AD) automatically. 4.Azure AD validates the Managed Identity's request and provides an access token to the Managed Identity. 5.The Managed Identity uses the received token to authenticate with the target Azure service. 6.The target Azure service validates the token and, if authorized, allows the Managed Identity to access the service's resources.
  • 10. User-Assigned Managed Identity Flow 1.You create a User-Assigned Managed Identity in Azure. 2.You assign the User-Assigned Managed Identity to one or more Azure resources (e.g., Virtual Machines, Azure Functions). 3.The application running on one of the assigned resources sends a request to access an Azure service. 4.The User-Assigned Managed Identity associated with the resource sends an authentication request to Azure AD. 5.Azure AD validates the Managed Identity's request and provides an access token to the Managed Identity. 6.The Managed Identity uses the token to authenticate with the target Azure service. 7.The target Azure service validates the token and, if authorized, allows the Managed Identity to access the service's resources.
  • 11. Service Principal Flow 1.An external application (e.g., a CI/CD pipeline) needs to interact with Azure services. 2.The external application uses a Service Principal's credentials (client ID and client secret) to request an access token from Azure AD. 3.Azure AD validates the Service Principal's credentials and provides an access token to the application. 4.The application uses the received token to authenticate with the target Azure service. 5.The target Azure service validates the token and, if authorized, allows the application (through the Service Principal) to access the service's resources.
  • 12. TokenCredential var defaultTokenCredential = new DefaultAzureCredential(); var systemManagedTokenCredential = new ManagedIdentityCredential(); var userManagedTokenCredential = new ManagedIdentityCredential("[clientId]"); var spTokenCredential = new ClientSecretCredential("[TenantId]", "[clientId]","[clientSecret]");
  • 13. Azure service that supports AAD authentication • API Management • Azure App Configuration • Azure App Services • Azure Batch • Azure Container Registry • Azure Cognitive Services • Azure Communication Services • Azure Cosmos DB • Azure Databricks • Azure Data Explorer • Azure Data Lake Storage Gen1 • Azure Database for PostgreSQL • Azure Digital Twins • Azure Event Hubs • Azure IoT Hub • Azure Key Vault • Azure Kubernetes Service (AKS) • Azure Machine Learning Services • Azure Maps • Azure Media services • Azure Monitor • Azure Resource Manager • Azure Service Fabric • Azure Service Bus • Azure SignalR Service • Azure SQL Azure Managed Instance • Azure Static Web Apps • Azure Storage • Azure Virtual Machines https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-id- authentication-support
  • 14. Demo • Key vault • App Insight – local auth disabled • Cosmos DB – local auth disabled and keyless • Azure Storage (Blob, Table, Queue, Files) • Etc.,
  • 15. CosmosDB – Disabling LocalAuth, R/W access $subscriptionId="[YOUR SUBSCRIPTION ID]" $cosmosDbAccountName = "[YOUR COSMOS ACCOUNT NAME]" $resourceGroupName = "[YOUR RESOURCE GROUP]" $objectId="[YOUR OBJECT ID]" $roleName="[YOUR CUSTOM ROLE NAME]" az account set --subscription $subscriptionId $cosmosdb = az cosmosdb show --name $cosmosDBAccountName --resource-group $resourceGroupName | ConvertFrom-Json #Disable Local Auth az resource update --ids $cosmosdb.id --set properties.disableLocalAuth=true #For Built-in Data Read/Write $roleDefId= '00000000-0000-0000-0000-000000000002' #001 -readonly #002- read/write az cosmosdb sql role assignment create --account-name $cosmosDbAccountName - -resource-group $resourceGroupName --role-definition-id $roleDefId -- principal-id $objectId --scope "/"
  • 16. Application Insight • Disable Enable Local auth from Overview • Give “Monitoring Metrics Publisher” permissions from Access Control section of the App Insight.
  • 18. Thanks for your time and trust! New Hampshire CLOUD .NET User Group

Editor's Notes

  1. https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-use-managed-identities
  2. https://www.youtube.com/watch?v=pENvLW28nDk
  3. In summary, the primary difference between Managed Identity and User-Assigned Managed Identity is in their scope and management: Managed Identity is tightly scoped to a single Azure resource and is automatically managed by Azure. User-Assigned Managed Identity is not bound to a specific resource and can be shared among multiple resources, giving you more control over identity management.
  4. In summary, the main difference between Managed Identity and Service Principal lies in their scope and how they are created and managed. Managed Identity is tied to a specific Azure resource and is managed by Azure, while a Service Principal is a more general identity that can be used by various applications and services and is managed by administrators.
  5. In summary, the main difference between Managed Identity and Service Principal lies in their scope and how they are created and managed. Managed Identity is tied to a specific Azure resource and is managed by Azure, while a Service Principal is a more general identity that can be used by various applications and services and is managed by administrators.
  6. Give “DocumentDB Account Contributor” permissions from Access Control section of the Cosmsos DB $subscriptionId="c593b82c-912d-4d7d-a389-553a5a80a463" $cosmosDbAccountName = "cosmos-udai" $resourceGroupName = "rg-demo-sep6" $objectId="92fa53e3-4cdb-4055-8daa-8b8470d1cf2d" $roleName="[YOUR CUSTOM ROLE NAME]" az account set --subscription $subscriptionId $cosmosdb = az cosmosdb show --name $cosmosDBAccountName --resource-group $resourceGroupName | ConvertFrom-Json #Disable Local Auth az resource update --ids $cosmosdb.id --set properties.disableLocalAuth=true #For Built-in Data Read/Write $roleDefId=  '00000000-0000-0000-0000-000000000002' #001 -readonly #002-read/write az cosmosdb sql role assignment create --account-name $cosmosDbAccountName --resource-group $resourceGroupName  --role-definition-id $roleDefId  --principal-id $objectId --scope "/"
  7. Give “Monitoring Metrics Publisher” permissions from Access Control section of the App Insight.