Zero Credential Development
with Managed Identities for
Azure Resources
Joonas Westlin, Zure Ltd
Speaker Intro
• Joonas Westlin
• Developer / Architect @ Zure
• Global #1 on Stack Overflow for Azure
AD answers
@JoonasWestlin
joonasw.net
Hold on, Key Vault didn’t
help anything!
Keys need to be
managed
Keys need to be
rotated
Keys need to be
revoked
Key issues
How could we do this
better?
Managed Identities for Azure Resources
Managed by
Azure
Automatically
rotated
Easily revoked
Zero
Credentials
Oh yeah this service is free
System-assigned? User-assigned?
• System-assigned identities
tied to a resource like App
Service or a VM
• Deleted when the resource
is deleted
• User-assigned identities
can be assigned to multiple
resources
• A resource can have more
than one
• Independent lifecycle
Enabling System-assigned Identity
Enabling User-assigned Identity
Where can I use it?
https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-
managed-identities
Virtual
Machines
VM Scale SetsFunctions
Data Factory API Management Blueprints Container
Registry Tasks
Logic Apps
Preview
Container
Instances
Preview
App Services
What can I access with it?
https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-
managed-identities
Azure SQL
Database
Key Vault Data Lake Blob Storage Queue Storage
Event Hubs Analysis Services ARM API AAD & MS Graph
API
Any API supporting
AAD auth*
Service Bus
HTTP Request
App Service instance
It’s Demo Time!
https://westl.in/midemo
Advanced: Usage against custom APIs
Advanced: Usage against custom APIs
PowerShell to the rescue!
How about local
development?
https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication/
Managed
Identity
Visual Studio AZ CLI
Windows
Authentication
Supported methods
• Managed Identity
• Visual Studio
• AZ CLI
• Integrated Windows Authentication
• Client id + secret
• Client id + certificate (can be local or in Key Vault)
• Advanced options unlocked by using connection string
https://docs.microsoft.com/en-us/azure/key-vault/service-to-service-authentication
My suggestions
• Use Visual Studio / AZ CLI / IWA for cases where it works
• RunAs=Developer; DeveloperTool=VisualStudio
• RunAs=Developer; DeveloperTool=AzureCli
• Use client id + secret / certificate where it does not
• RunAs=App;AppId={AppId};TenantId={TenantId};AppKey={Client
Secret}
• RunAs=App;AppId={AppId};TenantId={TenantId};CertificateThum
bprint={Thumbprint};CertificateStoreLocation={LocalMachine or
CurrentUser}
Summary
• Using Managed Identity is seriously recommended if
your app runs on Azure
• Access any service that supports Azure AD authentication
in a secure way
• Free service that can remove all secrets from your code
• .NET apps should use the AppAuthentication library
• Local development requires some effort
Links
• https://docs.microsoft.com/en-us/azure/active-
directory/managed-identities-azure-resources/overview
• https://github.com/juunas11/managedidentity-
filesharing
• https://github.com/juunas11/Joonasw.ManagedIdentityD
emos
@JoonasWestlin joonasw.net

Zero Credential Development with Managed Identities