SlideShare a Scribd company logo
1 of 40
PASSWORDLESS
DEVELOPMENT USING
AZURE IDENTITY
Presented by Sarah Dutkiewicz
Microsoft MVP, Developer Technologies
AGENDA
• Problems with Credentials in Azure Development
• Alternatives
• Introducing Azure Identity SDK for .NET
• Introducing DefaultAzureCredential
• Introducing ChainedTokenCredential
• Demos, demos, and more demos
WHERE DO YOU STORE YOUR PASSWORDS?
• Config files
• App config – like here? Deploying
passwords and other sensitive data to
ASP.NET and Azure App Service -
ASP.NET 4.x | Microsoft Docs
• Secrets config
• Add these to .gitignore!
• Environment Variables
• How are you loading the values into
your environment?
• Secret Manager
• For development purposes only, not
encrypted
• Azure Key Vault
<appSettings>
<!-- SendGrid-->
<add key="mailAccount" value="My mail account." />
<add key="mailPassword" value="My mail password." />
<!-- Twilio-->
<add key="TwilioSid" value="My Twilio SID." />
<add key="TwilioToken" value="My Twilio Token." />
<add key="TwilioFromPhone" value="+12065551234" />
<add key="GoogClientID"
value="1.apps.googleusercontent.com" />
<add key="GoogClientSecret" value="My Google client
secret." />
</appSettings>
THE PROBLEMS WITH CONFIG FILES
• Typically in plain text
• Sometimes stored encrypted… with the code to decrypt it 🤦🏻♀️
• Pushed into a public repo or a private repo in the wrong hands = more trouble
This Photo by Unknown Author is licensed under CC BY-NC-ND
AZURE KEY VAULT - SECRETPASSWORD
AZURE KEY VAULT –
ACCESS
• RBAC users
• Managed identities
• Service principals
• Can add and revoke permissions
• Access Policies only shows values if
RBAC is not enabled
• Otherwise use Access Control (IAM)
to set permissions
ALTERNATIVES TO USER CREDENTIALS IN AZURE
• Managed identities
• X.509 certificates
• Service principals
MANAGED IDENTITIES
• A way to authorize access to Azure
resources between Azure resources
that support Azure AD Microsoft
Entra ID authentication
• No credentials needed, no tokens to
manage
• Can be used in RBAC assignment
• No extra cost!
TWO TYPES OF MANAGED IDENTITIES
• System-assigned:
• Can be enabled on service and assigned by the system
• Creates identity in Microsoft Entra ID
• Automatically deleted when resource is deleted
• Limited to just that resource
• User-assigned:
• You create it in Microsoft Entra ID
• Assign to one or more instances of Azure service
• Manual management – does not automatically delete when no longer used
SERVICES THAT USE MANAGED IDENTITIES
• Not all platforms support managed identities yet
• Some platforms support managed identities in limited cases
• Some platforms have better managed identity support
• Azure Key Vault
• Azure App Service
• Azure Kubernetes Service
• Azure Data Factory
• Complete, updated list is available at: Azure services that can use managed identities
to access other services
X.509 CERTIFICATES FOR AUTHENTICATION
• Microsoft Entra certificate based authentication (CBA)
• Recommended as a security best practice – no password secrets
• X.509 certificates verified against Enterprise Public Key Infrastructure (PKI)
• Requires setup in Microsoft Entra
• Certificate authority
• Authentication binding policy
• Username binding policy
• Enable CBA
• No additional cost!
• Available in every edition of Microsoft Entra
• Learn more: How to configure Microsoft Entra certificate-based authentication
SERVICE PRINCIPALS
• A way to identify an application or user registered in Microsoft Entra
• Created as part of app registration
• Three types
• Application
• Managed identity
• Legacy – created before app registrations were added to Microsoft Entra
• Only used in the tenant where created
• Credentials, service principal names, reply URLs, etc. not in app registration
• Can be used in RBAC assignments
• Learn more: Apps & service principals objects in Microsoft Entra ID - Microsoft Entra | Microsoft
Docs
SERVICE PRINCIPAL NOTES
• Originated more similar to Windows Server Active Directory
• Not all service principals have application objects
• Uses the command:
az ad sp create-for-rbac –role {ROLE} –scopes /subscriptions/{SUBSCRIPTION_ID}
OUTPUT FROM SERVICE PRINCIPAL CREATION
{
"appId": "AZURE_CLIENT_ID",
"displayName": "{SERVICE_PRINCIPAL_NAME}",
"password": "AZURE_CLIENT_SECRET",
"tenant": "AZURE_TENANT_ID"
}
RECOMMENDATIONS ON WHAT TO CHOOSE
INTRODUCING THE
AZURE IDENTITY SDK FOR .NET
KEY CONCEPTS
• TokenCredential
• DefaultAzureCredential
• ChainedTokenCredential
TOKENCREDENTIAL
• Base for the credentials that can provide OAuth tokens
MORE TOKENCREDENTIALS
DEFAULTAZURECREDENTIAL VS
CHAINEDTOKENCREDENTIAL
DefaultAzureCredential
• Comes with a pre-
defined token chain
• Works for simply getting
started
• Credentials can be
excluded through the
DefaultCredentialOptions
ChainedTokenCredential
• Empty chain that you
define
• Highly recommended for
production loads
INTRODUCING
DEFAULTAZURECREDENTIAL
DEFAULTAZURECREDENTIAL
• Part of Azure Identity
• Available in many of the Azure SDKs including:
• Java
• .NET
• JavaScript
• Python
• Makes it easier for working with Azure resources and credentials without storing the
credentials in config files
• Uses a chain of credentials for authentication
DEFAULTAZURECREDENTIAL ORDER OF CHECKING
1. EnvironmentCredential – environment variables
2. WorkloadIdentityCredential - workload identity authentication on Kubernetes
3. ManagedIdentityCredential – managed identity
4. VisualStudioCredential – auth from Visual Studio
5. VisualStudioCodeCredential – auth from Visual Studio Code
6. AzureCliCredential – auth from Azure CLI
7. AzurePowerShellCredential- auth from Azure PowerShell
8. InteractiveBrowserCredential – auth with a browser prompt; not enabled by default
FAILURE ERROR WITH CHAIN
• azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to
retrieve a token from the included credentials.
• Attempted credentials:
• EnvironmentCredential: EnvironmentCredential authentication unavailable.
Environment variables are not fully configured.
• Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to
troubleshoot.this issue.
• ManagedIdentityCredential: ManagedIdentityCredential authentication
unavailable, no response from the IMDS endpoint.
• SharedTokenCacheCredential: Shared token cache unavailable
• VisualStudioCodeCredential: Azure Active Directory error '(invalid_grant)
AADSTS700082: The refresh token has expired due to inactivity. The token
w"ef2cbcdb-b45b-411a-82e8-4da4de87e200","correlation_id":"a5787e3d-7be9-40f9-b6ec-
02f5c2d90ae2","error_uri":"https://login.microsoftonline.com/error?code=700082"}
• To mitigate this issue, please refer to the troubleshooting guidelines here at
https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot
NOTES ON THE CREDENTIAL CHAIN
• Interactive browser option needs to be included explicitly
• Credential types can be excluded in DefaultAzureCredentialOptions
• For example, PowerShell vs Azure CLI preference
• Managed identity is assumed as system-assigned
• Explicitly set client ID for user-assigned identities in DefaultAzureCredentialOptions
• Tenant ID can be overridden in the DefaultAzureCredentialOptions object
• By default, targets public cloud. Can change the authority host as part of
DefaultAzureCredentialOptions
ENVIRONMENT CREDENTIAL
• Works well with service principals and general credentials
• Looks for environment variables with specific names:
• AZURE_CLIENT_ID
• AZURE_CLIENT_SECRET
• AZURE_TENANT_ID
• AZURE_CLIENT_CERTIFICATE_PATH
• AZURE_CLIENT_SEND_CERTIFICATE_CHAIN
• AZURE_USERNAME
• AZURE_PASSWORD
• AZURE_AUTHORITY_HOST
MANAGED IDENTITIES
• Used between Azure resources
• Managed in Azure Active Directory
• System-assigned and user-assigned
• No need to store any credentials
• You can’t even access the credentials
• No extra cost
IDE CREDENTIALS
• Visual Studio
• Visual Studio Code
COMMAND-LINE CREDENTIALS
• PowerShell
• Azure CLI
INTERACTIVE BROWSER
• Must be enabled when constructing the DefaultAzureCredential object
• Set includeInteractiveCredentials to true
• Set ExcludeInteractiveBrowserCredential to false in
DefaultAzureCredentialOptions
INTRODUCING
CHAINEDTOKENCREDENTIAL
CHAINED CREDENTIALS
• Starts as a new chain that you initialize with the collection of credential types, in
the order to be tested
• Can include any of the credentials mentioned plus other credentials that inherit
from TokenCredential, including:
• AuthorizationCodeCredential
• ClientSecretCredential
• DeviceCodeCredential
• OnBehalfOfCredential
CHAINEDTOKENCREDENTIAL CHAINS
DEMO: CREATURE CATALOG
Creating a Holiday Creatures Catalog in Azure with Secure Credentials
DEMOS: JAVA
Demos
• Azure App Service
• Azure Spring Apps
Resources
• Azure Authentication in Java development environments | Microsoft Docs
• Quickstart - Azure Key Vault Secret client library for Java | Microsoft Docs
PYTHON
• Quickstart – Azure Key Vault Python client library – manage secrets | Microsoft
Docs
• Azure Identity client library for Python | Microsoft Docs
• Troubleshoot DefaultAzureCredential Authentication Issues (Python)
C#
• Azure Identity client library for .NET - Azure for .NET Developers | Microsoft Docs
• Quickstart - Azure Key Vault keys client library for .NET (SDK version 4) | Microsoft
Docs
RESOURCES
• Authentication and the Azure SDK - Azure SDK Blog (microsoft.com)
• DefaultAzureCredential Class
• Java
• .NET
• JavaScript
• Python
• Azure Key Vault developer's guide | Microsoft Docs
TWITTER: @SADUKIE
LINKEDIN: HTTPS://LINKEDIN.COM/IN/SADUKIE
Any Questions?

More Related Content

Similar to Passwordless Development using Azure Identity

DevSum: Azure AD B2C Application security made easy
DevSum: Azure AD B2C Application security made easyDevSum: Azure AD B2C Application security made easy
DevSum: Azure AD B2C Application security made easySjoukje Zaal
 
Azure Key Vault - Getting Started
Azure Key Vault - Getting StartedAzure Key Vault - Getting Started
Azure Key Vault - Getting StartedTaswar Bhatti
 
Data Encryption - Azure Storage Service
Data Encryption - Azure Storage ServiceData Encryption - Azure Storage Service
Data Encryption - Azure Storage ServiceUdaiappa Ramachandran
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesJoonas Westlin
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic Ukraine
 
External collaboration with Azure B2B
External collaboration with Azure B2B External collaboration with Azure B2B
External collaboration with Azure B2B Sjoukje Zaal
 
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
 
Intelligent Cloud Conference: Azure AD B2C Application security made easy
Intelligent Cloud Conference: Azure AD B2C Application security made easyIntelligent Cloud Conference: Azure AD B2C Application security made easy
Intelligent Cloud Conference: Azure AD B2C Application security made easySjoukje Zaal
 
Hitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKCHitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKCMax Fritz
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesJoonas Westlin
 
External collaboration with Azure B2B
External collaboration with Azure B2BExternal collaboration with Azure B2B
External collaboration with Azure B2BSjoukje Zaal
 
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughAzure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughVinu Gunasekaran
 
Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020Microsoft 365 Developer
 
Dear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2BDear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2BSjoukje Zaal
 
Azure - Identity as a service
Azure - Identity as a serviceAzure - Identity as a service
Azure - Identity as a serviceBizTalk360
 
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL Certificates
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL CertificatesHashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL Certificates
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL CertificatesNick Maludy
 
Global Azure - Use Azure Active Directory Managed Identities for your services!
Global Azure - Use Azure Active Directory Managed Identities for your services!Global Azure - Use Azure Active Directory Managed Identities for your services!
Global Azure - Use Azure Active Directory Managed Identities for your services!Jan de Vries
 
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...DevClub_lv
 
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
 
CSF18 - External Collaboration with Azure B2B - Sjoukje Zaal
CSF18 - External Collaboration with Azure B2B - Sjoukje ZaalCSF18 - External Collaboration with Azure B2B - Sjoukje Zaal
CSF18 - External Collaboration with Azure B2B - Sjoukje ZaalNCCOMMS
 

Similar to Passwordless Development using Azure Identity (20)

DevSum: Azure AD B2C Application security made easy
DevSum: Azure AD B2C Application security made easyDevSum: Azure AD B2C Application security made easy
DevSum: Azure AD B2C Application security made easy
 
Azure Key Vault - Getting Started
Azure Key Vault - Getting StartedAzure Key Vault - Getting Started
Azure Key Vault - Getting Started
 
Data Encryption - Azure Storage Service
Data Encryption - Azure Storage ServiceData Encryption - Azure Storage Service
Data Encryption - Azure Storage Service
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed Identities
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
External collaboration with Azure B2B
External collaboration with Azure B2B External collaboration with Azure B2B
External collaboration with Azure B2B
 
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
 
Intelligent Cloud Conference: Azure AD B2C Application security made easy
Intelligent Cloud Conference: Azure AD B2C Application security made easyIntelligent Cloud Conference: Azure AD B2C Application security made easy
Intelligent Cloud Conference: Azure AD B2C Application security made easy
 
Hitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKCHitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKC
 
Zero Credential Development with Managed Identities
Zero Credential Development with Managed IdentitiesZero Credential Development with Managed Identities
Zero Credential Development with Managed Identities
 
External collaboration with Azure B2B
External collaboration with Azure B2BExternal collaboration with Azure B2B
External collaboration with Azure B2B
 
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughAzure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
 
Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020
 
Dear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2BDear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2B
 
Azure - Identity as a service
Azure - Identity as a serviceAzure - Identity as a service
Azure - Identity as a service
 
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL Certificates
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL CertificatesHashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL Certificates
Hashitalks 2021 - How the Dynamic Duo of Vault and Puppet Tame SSL Certificates
 
Global Azure - Use Azure Active Directory Managed Identities for your services!
Global Azure - Use Azure Active Directory Managed Identities for your services!Global Azure - Use Azure Active Directory Managed Identities for your services!
Global Azure - Use Azure Active Directory Managed Identities for your services!
 
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...
Using Azure Managed Identities for your App Services by Jan de Vries from 4Do...
 
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
 
CSF18 - External Collaboration with Azure B2B - Sjoukje Zaal
CSF18 - External Collaboration with Azure B2B - Sjoukje ZaalCSF18 - External Collaboration with Azure B2B - Sjoukje Zaal
CSF18 - External Collaboration with Azure B2B - Sjoukje Zaal
 

More from Sarah Dutkiewicz

Predicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksPredicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksSarah Dutkiewicz
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Azure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersAzure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersSarah Dutkiewicz
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalSarah Dutkiewicz
 
Noodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookNoodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookSarah Dutkiewicz
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# DevelopersSarah Dutkiewicz
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDDSarah Dutkiewicz
 
Becoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesBecoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesSarah Dutkiewicz
 
NEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesNEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesSarah Dutkiewicz
 
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerThe Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerSarah Dutkiewicz
 
The importance of UX for Developers
The importance of UX for DevelopersThe importance of UX for Developers
The importance of UX for DevelopersSarah Dutkiewicz
 
The Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechThe Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechSarah Dutkiewicz
 
Unstoppable Course Final Presentation
Unstoppable Course Final PresentationUnstoppable Course Final Presentation
Unstoppable Course Final PresentationSarah Dutkiewicz
 
Even More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltEven More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltSarah Dutkiewicz
 
History of Women in Tech - Trivia
History of Women in Tech - TriviaHistory of Women in Tech - Trivia
History of Women in Tech - TriviaSarah Dutkiewicz
 
The UX Toolbelt for Developers
The UX Toolbelt for DevelopersThe UX Toolbelt for Developers
The UX Toolbelt for DevelopersSarah Dutkiewicz
 
World Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersWorld Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersSarah Dutkiewicz
 

More from Sarah Dutkiewicz (20)

Predicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksPredicting Flights with Azure Databricks
Predicting Flights with Azure Databricks
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Azure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersAzure DevOps for JavaScript Developers
Azure DevOps for JavaScript Developers
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data Professional
 
Noodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookNoodling with Data in Jupyter Notebook
Noodling with Data in Jupyter Notebook
 
Pairing and mobbing
Pairing and mobbingPairing and mobbing
Pairing and mobbing
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# Developers
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
 
Becoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesBecoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the Trenches
 
NEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesNEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future Techies
 
Becoming a Servant Leader
Becoming a Servant LeaderBecoming a Servant Leader
Becoming a Servant Leader
 
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerThe Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
 
The importance of UX for Developers
The importance of UX for DevelopersThe importance of UX for Developers
The importance of UX for Developers
 
The Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechThe Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in Tech
 
Unstoppable Course Final Presentation
Unstoppable Course Final PresentationUnstoppable Course Final Presentation
Unstoppable Course Final Presentation
 
Even More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltEven More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX Toolbelt
 
History of Women in Tech
History of Women in TechHistory of Women in Tech
History of Women in Tech
 
History of Women in Tech - Trivia
History of Women in Tech - TriviaHistory of Women in Tech - Trivia
History of Women in Tech - Trivia
 
The UX Toolbelt for Developers
The UX Toolbelt for DevelopersThe UX Toolbelt for Developers
The UX Toolbelt for Developers
 
World Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersWorld Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for Developers
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
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
 
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
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Passwordless Development using Azure Identity

  • 1. PASSWORDLESS DEVELOPMENT USING AZURE IDENTITY Presented by Sarah Dutkiewicz Microsoft MVP, Developer Technologies
  • 2. AGENDA • Problems with Credentials in Azure Development • Alternatives • Introducing Azure Identity SDK for .NET • Introducing DefaultAzureCredential • Introducing ChainedTokenCredential • Demos, demos, and more demos
  • 3. WHERE DO YOU STORE YOUR PASSWORDS? • Config files • App config – like here? Deploying passwords and other sensitive data to ASP.NET and Azure App Service - ASP.NET 4.x | Microsoft Docs • Secrets config • Add these to .gitignore! • Environment Variables • How are you loading the values into your environment? • Secret Manager • For development purposes only, not encrypted • Azure Key Vault <appSettings> <!-- SendGrid--> <add key="mailAccount" value="My mail account." /> <add key="mailPassword" value="My mail password." /> <!-- Twilio--> <add key="TwilioSid" value="My Twilio SID." /> <add key="TwilioToken" value="My Twilio Token." /> <add key="TwilioFromPhone" value="+12065551234" /> <add key="GoogClientID" value="1.apps.googleusercontent.com" /> <add key="GoogClientSecret" value="My Google client secret." /> </appSettings>
  • 4. THE PROBLEMS WITH CONFIG FILES • Typically in plain text • Sometimes stored encrypted… with the code to decrypt it 🤦🏻♀️ • Pushed into a public repo or a private repo in the wrong hands = more trouble This Photo by Unknown Author is licensed under CC BY-NC-ND
  • 5. AZURE KEY VAULT - SECRETPASSWORD
  • 6. AZURE KEY VAULT – ACCESS • RBAC users • Managed identities • Service principals • Can add and revoke permissions • Access Policies only shows values if RBAC is not enabled • Otherwise use Access Control (IAM) to set permissions
  • 7. ALTERNATIVES TO USER CREDENTIALS IN AZURE • Managed identities • X.509 certificates • Service principals
  • 8. MANAGED IDENTITIES • A way to authorize access to Azure resources between Azure resources that support Azure AD Microsoft Entra ID authentication • No credentials needed, no tokens to manage • Can be used in RBAC assignment • No extra cost!
  • 9. TWO TYPES OF MANAGED IDENTITIES • System-assigned: • Can be enabled on service and assigned by the system • Creates identity in Microsoft Entra ID • Automatically deleted when resource is deleted • Limited to just that resource • User-assigned: • You create it in Microsoft Entra ID • Assign to one or more instances of Azure service • Manual management – does not automatically delete when no longer used
  • 10. SERVICES THAT USE MANAGED IDENTITIES • Not all platforms support managed identities yet • Some platforms support managed identities in limited cases • Some platforms have better managed identity support • Azure Key Vault • Azure App Service • Azure Kubernetes Service • Azure Data Factory • Complete, updated list is available at: Azure services that can use managed identities to access other services
  • 11. X.509 CERTIFICATES FOR AUTHENTICATION • Microsoft Entra certificate based authentication (CBA) • Recommended as a security best practice – no password secrets • X.509 certificates verified against Enterprise Public Key Infrastructure (PKI) • Requires setup in Microsoft Entra • Certificate authority • Authentication binding policy • Username binding policy • Enable CBA • No additional cost! • Available in every edition of Microsoft Entra • Learn more: How to configure Microsoft Entra certificate-based authentication
  • 12. SERVICE PRINCIPALS • A way to identify an application or user registered in Microsoft Entra • Created as part of app registration • Three types • Application • Managed identity • Legacy – created before app registrations were added to Microsoft Entra • Only used in the tenant where created • Credentials, service principal names, reply URLs, etc. not in app registration • Can be used in RBAC assignments • Learn more: Apps & service principals objects in Microsoft Entra ID - Microsoft Entra | Microsoft Docs
  • 13. SERVICE PRINCIPAL NOTES • Originated more similar to Windows Server Active Directory • Not all service principals have application objects • Uses the command: az ad sp create-for-rbac –role {ROLE} –scopes /subscriptions/{SUBSCRIPTION_ID}
  • 14. OUTPUT FROM SERVICE PRINCIPAL CREATION { "appId": "AZURE_CLIENT_ID", "displayName": "{SERVICE_PRINCIPAL_NAME}", "password": "AZURE_CLIENT_SECRET", "tenant": "AZURE_TENANT_ID" }
  • 17. KEY CONCEPTS • TokenCredential • DefaultAzureCredential • ChainedTokenCredential
  • 18. TOKENCREDENTIAL • Base for the credentials that can provide OAuth tokens
  • 20. DEFAULTAZURECREDENTIAL VS CHAINEDTOKENCREDENTIAL DefaultAzureCredential • Comes with a pre- defined token chain • Works for simply getting started • Credentials can be excluded through the DefaultCredentialOptions ChainedTokenCredential • Empty chain that you define • Highly recommended for production loads
  • 22. DEFAULTAZURECREDENTIAL • Part of Azure Identity • Available in many of the Azure SDKs including: • Java • .NET • JavaScript • Python • Makes it easier for working with Azure resources and credentials without storing the credentials in config files • Uses a chain of credentials for authentication
  • 23.
  • 24. DEFAULTAZURECREDENTIAL ORDER OF CHECKING 1. EnvironmentCredential – environment variables 2. WorkloadIdentityCredential - workload identity authentication on Kubernetes 3. ManagedIdentityCredential – managed identity 4. VisualStudioCredential – auth from Visual Studio 5. VisualStudioCodeCredential – auth from Visual Studio Code 6. AzureCliCredential – auth from Azure CLI 7. AzurePowerShellCredential- auth from Azure PowerShell 8. InteractiveBrowserCredential – auth with a browser prompt; not enabled by default
  • 25. FAILURE ERROR WITH CHAIN • azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials. • Attempted credentials: • EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. • Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue. • ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint. • SharedTokenCacheCredential: Shared token cache unavailable • VisualStudioCodeCredential: Azure Active Directory error '(invalid_grant) AADSTS700082: The refresh token has expired due to inactivity. The token w"ef2cbcdb-b45b-411a-82e8-4da4de87e200","correlation_id":"a5787e3d-7be9-40f9-b6ec- 02f5c2d90ae2","error_uri":"https://login.microsoftonline.com/error?code=700082"} • To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot
  • 26. NOTES ON THE CREDENTIAL CHAIN • Interactive browser option needs to be included explicitly • Credential types can be excluded in DefaultAzureCredentialOptions • For example, PowerShell vs Azure CLI preference • Managed identity is assumed as system-assigned • Explicitly set client ID for user-assigned identities in DefaultAzureCredentialOptions • Tenant ID can be overridden in the DefaultAzureCredentialOptions object • By default, targets public cloud. Can change the authority host as part of DefaultAzureCredentialOptions
  • 27. ENVIRONMENT CREDENTIAL • Works well with service principals and general credentials • Looks for environment variables with specific names: • AZURE_CLIENT_ID • AZURE_CLIENT_SECRET • AZURE_TENANT_ID • AZURE_CLIENT_CERTIFICATE_PATH • AZURE_CLIENT_SEND_CERTIFICATE_CHAIN • AZURE_USERNAME • AZURE_PASSWORD • AZURE_AUTHORITY_HOST
  • 28. MANAGED IDENTITIES • Used between Azure resources • Managed in Azure Active Directory • System-assigned and user-assigned • No need to store any credentials • You can’t even access the credentials • No extra cost
  • 29. IDE CREDENTIALS • Visual Studio • Visual Studio Code
  • 31. INTERACTIVE BROWSER • Must be enabled when constructing the DefaultAzureCredential object • Set includeInteractiveCredentials to true • Set ExcludeInteractiveBrowserCredential to false in DefaultAzureCredentialOptions
  • 33. CHAINED CREDENTIALS • Starts as a new chain that you initialize with the collection of credential types, in the order to be tested • Can include any of the credentials mentioned plus other credentials that inherit from TokenCredential, including: • AuthorizationCodeCredential • ClientSecretCredential • DeviceCodeCredential • OnBehalfOfCredential
  • 35. DEMO: CREATURE CATALOG Creating a Holiday Creatures Catalog in Azure with Secure Credentials
  • 36. DEMOS: JAVA Demos • Azure App Service • Azure Spring Apps Resources • Azure Authentication in Java development environments | Microsoft Docs • Quickstart - Azure Key Vault Secret client library for Java | Microsoft Docs
  • 37. PYTHON • Quickstart – Azure Key Vault Python client library – manage secrets | Microsoft Docs • Azure Identity client library for Python | Microsoft Docs • Troubleshoot DefaultAzureCredential Authentication Issues (Python)
  • 38. C# • Azure Identity client library for .NET - Azure for .NET Developers | Microsoft Docs • Quickstart - Azure Key Vault keys client library for .NET (SDK version 4) | Microsoft Docs
  • 39. RESOURCES • Authentication and the Azure SDK - Azure SDK Blog (microsoft.com) • DefaultAzureCredential Class • Java • .NET • JavaScript • Python • Azure Key Vault developer's guide | Microsoft Docs

Editor's Notes

  1. Working with credentials for Azure resources, you want to avoid storing your credentials in repositories when possible. In this session, we will talk about some of the options for working with credentials in Azure development without checking them into repositories - including service principals, managed identities, and DefaultAzureCredential.
  2. Service principals are part of application registrations. It serves as the app’s identity in Microsoft Entra.
  3. Image taken from: Overview: Authenticate Python apps to Azure using the Azure SDK | Microsoft Docs
  4. Running the Python demo locally in Visual Studio Code. You can see the chain of creds it tried.
  5. Reference: Managed identities for Azure resources - Microsoft Entra | Microsoft Docs
  6. mvn exec:java -D"exec.mainClass"="com.keyvault.secrets.quickstart.App"