Azure SDK DefaultAzureCredential : Unifying How We Get Azure AD Token

  Рет қаралды 20,349

Rahul Nath

Rahul Nath

4 жыл бұрын

In this video, we will look into the DefaultAzureCredential class that is part of the Azure Identity library. It is the new and unified way to connect and retrieve tokens from Azure Active Directory and can be used along with resources that need them. We will look at how to authenticate and interact with Azure Key Vault and Microsoft Graph API.
Blog Post: www.rahulpnath.com/blog/defau...
NuGet Packages
Azure.Identity - www.nuget.org/packages/Azure....
Microsoft.Azure.KeyVault (v3) - www.nuget.org/packages/Micros...
Azure.Security.KeyVault.Secrets (v4) - www.nuget.org/packages/Azure....
Microsoft.Graph - www.nuget.org/packages/Micros...
Microsoft Graph API Using Managed Service Identity - • Microsoft Graph API Us...

Пікірлер: 51
@sreenivasv3042
@sreenivasv3042 2 жыл бұрын
Who is this man. He explains everything in a crisp short videos. Become a fan. Will explore his content and also suggest others to do so.
@RahulNath
@RahulNath 2 жыл бұрын
Thank you Sreenivas. Glad this helped you. Here are some of my popular series twitter.com/rahulpnath/status/1499626419357630466?s=20&t=-jrWULXvhBW7io3aw8Cwiw
@tauqirchaudhry2876
@tauqirchaudhry2876 4 жыл бұрын
Thanks, I was working with AzureServiceTokenProvider and saw that it was deprecated, this video was very helpful in quickly changing my code to use DefaultAzureCredential.
@RahulNath
@RahulNath 4 жыл бұрын
Happy to hear that and thank you for letting know!
@RubenMartirosyan0
@RubenMartirosyan0 Жыл бұрын
OMG the only normal explanation
@balajis8279
@balajis8279 2 жыл бұрын
Great! Very professional
@RahulNath
@RahulNath 2 жыл бұрын
Thank you very much!
@graphicsxp
@graphicsxp 4 жыл бұрын
that's what I was looking for, very nice. However how do you add the SecretClient to the configuration ? In the past we could use config.AddAzureKeyVault from the Microsoft.Extensions. But I see no equivalent with SDK 4
@RahulNath
@RahulNath 4 жыл бұрын
Can you check if the below post and video helps you Video - kzfaq.info/get/bejne/bNKPntOqzLWUeZc.html Blog post - www.rahulpnath.com/blog/connect_net_core_to_azure_key_vault_in_ten_minutes/ Let know if you need any further help there
@graphicsxp
@graphicsxp 4 жыл бұрын
@@RahulNath Thanks. In the end I managed to do it using the package azure.extensions.aspnetcore.configuration.secrets
@troyw6681
@troyw6681 3 жыл бұрын
Because we could be using Environment, MSI, etc... I'd like to capture the method used... or at least what identity we are using. Is there a way that we can log this information?
@RahulNath
@RahulNath 3 жыл бұрын
Looks like this is still work in progress. Here are two associated tickets github.com/Azure/azure-sdk-for-net/issues/8948 github.com/Azure/azure-sdk-for-net/pull/18906 It was pointed out to me by someone on twitter (twitter.com/gmantri/status/1402503825211072516) Hope that helps you!
@riyazbasha7982
@riyazbasha7982 Жыл бұрын
Hey Rahul, could you please make a video on using user managed identity and testing the same in local?
@RahulNath
@RahulNath Жыл бұрын
it’s available here and the blog www.rahulpnath.com/blog/azure-managed-service-identity-and-local-development/
@Christobanistan
@Christobanistan 3 жыл бұрын
Is that PS script still necessary? Can't you just use the Azure portal API permissions and grant them to the Graph API there?
@RahulNath
@RahulNath 3 жыл бұрын
You might be right. Does the Portal allow you to select and assign permissions for the Managed Identity principal? It didn't have the functionality earlier.
@riyazbasha7982
@riyazbasha7982 Жыл бұрын
getting this error any help "Unauthorized access. 'Send' claim(s) are required to perform this operation."
@RahulNath
@RahulNath Жыл бұрын
Hope you resolved this issue Riyaz
@vvijayar
@vvijayar 2 жыл бұрын
Hello Rahul , thanks again for posting nice videos. Can we use DefaultAzureCredential to call a Web Api registered in AD from an Asp.NET Web client (blazor or mvc), will credentials get passed? additionally have you tried deploying this to IIS , how will defaultazurecredentials work there? Thank you
@RahulNath
@RahulNath 2 жыл бұрын
For requests happening on behalf of the server the credentials will get passed along. When you say blazor are you connecting to a different resource from the client side? I haven't tried this from IIS - Are you hosting it on a VM?
@vvijayar
@vvijayar 2 жыл бұрын
@@RahulNath thanks Rahul , yes it’s hybrid. my apps will be hosted in on-Prem VM but we use Azure AD and KeyVault, My main goal is to connect to Key Vault via managed identity so that settings.Json can be free of any plain text credentials or client secrets.
@RahulNath
@RahulNath 2 жыл бұрын
@@vvijayar This link should be a good start docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities Let me know if that helps
@alwaseem5309
@alwaseem5309 Жыл бұрын
Your content is amazing to start with. Is this still the recommended approach? DelegateAuthenticationProvider is missing now.
@RahulNath
@RahulNath 11 ай бұрын
Haven't used this recently - Did you find a solution for it?
@shravanbachu6298
@shravanbachu6298 2 жыл бұрын
user should be there in azure active directory to use managed identity ?
@RahulNath
@RahulNath 2 жыл бұрын
Yes user needs to be in the AD - What scenario are you looking to use this for?
@TheShrutika
@TheShrutika 2 жыл бұрын
Hi great video !!! i am using similar code using defaultAzureCredentials in visual studio but still i am getting forbidden 403. Can you please tell me what could the possible reasons? i have given the correct role assignment as well.
@RahulNath
@RahulNath 2 жыл бұрын
Can you make sure you Visual Studio is connect to the correct Azure AD. It's there in the options. Let me know in case you are still having an issue.
@SirBenJamin_
@SirBenJamin_ 3 жыл бұрын
Hello, I am running Vs2017 and don't seem to have the Azure options under Tools -> Options? is it only available in 2019?
@RahulNath
@RahulNath 3 жыл бұрын
Hard to tell that Ben. I don't have a 2017 version now. Did you check if there are any Azure extensions that needs to be installed? What are you trying to do from Visual Studio and Azure? Maybe you could try using the portal directly.
@SirBenJamin_
@SirBenJamin_ 3 жыл бұрын
@@RahulNath I was following your 'Connect .Net Core to Azure Key Vault in Ten Minutes', and for the DefaultAzureCredential stuff to work I thought you had to sign into Azure from visual studio so it can cache your login? which was why I was trying to find the option to sign into azure under Tools -> Options, but maybe I have this wrong?
@RahulNath
@RahulNath 3 жыл бұрын
​@@SirBenJamin_ I am not sure about VS 2017. Is it the 'Azure Service Authentication' option that you are looking for that I show here kzfaq.info/get/bejne/faeTedGftd6rn6s.html If that does not work, I explore different options to set up a local dev environment in that video using MI. Let me know if any of that helps.
@SirBenJamin_
@SirBenJamin_ 3 жыл бұрын
@@RahulNath thanks, I'll take a look!
@RahulNath
@RahulNath 3 жыл бұрын
@@SirBenJamin_ Let know how that goes.
@yyassaman74
@yyassaman74 3 жыл бұрын
Your videos are the best videos about Azure. I have a question. Is there any way to get this token via api? I have to assign a blueprint via api with user assigned managed identity. I couldn't find any clear article in ms documentation. Any advice would be appreciated
@RahulNath
@RahulNath 3 жыл бұрын
Thank you Jasmine. Glad you are liking the videos. The SDK's should be accessing them via an API so it should be possible. This link does talk about it. docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http Does that help you? You could also try using azure cli docs.microsoft.com/en-us/cli/azure/identity?view=azure-cli-latest Let me know if you have additional questions.
@yyassaman74
@yyassaman74 3 жыл бұрын
@@RahulNath Thank you very much. I have tried them. But I want to assign blueprint before creating a vm. Do I need a vm for authentication against api?
@RahulNath
@RahulNath 3 жыл бұрын
@@yyassaman74 Can you provide more details on what you are trying to do?
@yyassaman74
@yyassaman74 3 жыл бұрын
@@RahulNath I have to assign a blueprint via Rest API (docs.microsoft.com/en-us/rest/api/blueprints/assignments/create-or-update#assignment-with-user-assigned-managed-identity-at-subscription-scope) How can I get token with managed identity? Managed Identity is like below: { "id": "/subscriptions/xxx-xxx-xxx/resourcegroups/xxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxx", "name": "xxx", "type": "Microsoft.ManagedIdentity/userAssignedIdentities", "location": "westeurope", "tags": {}, "properties": { "tenantId": "xxx", "principalId": "xxx", "clientId": "xxx" } } The enterprise app that created with managed identity hasn't any client secret. How can I get token for assign the the blueprint via api?
@gva1108
@gva1108 Жыл бұрын
Very good explanation but my requirement is I need to call this via an api and get the secret and pass the same to backend. could you please share your email so that I can contact you
@RahulNath
@RahulNath Жыл бұрын
Thank you - Can you explain your scenario a bit more and the problem you are trying to solve?
@gva1108
@gva1108 Жыл бұрын
@@RahulNath Thanks again for quick help . Scenario When a request is initiated by the client to access a resource through azure API Gateway follow should happen. When a request is initiated it should come to azure API Gateway and then gateway will fetch the token which is sent by client and retrieve details like application I'd and scope from it and then it should call the keyvault vault service and for sake of authentication it should call the token service and then get the token and pass to keyvault for authentication and get the secret .Any suggestions or help to implement it
@gva1108
@gva1108 Жыл бұрын
And this token service generally runs on vm as it is assigned as identity managed entity
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 15 МЛН
когда повзрослела // EVA mash
00:40
EVA mash
Рет қаралды 4,5 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 98 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 56 МЛН
Simple, Fast, Idiomatic: An Intro to the Azure SDK for Python
26:05
Microsoft Azure Developers
Рет қаралды 1,9 М.
Microsoft API - Get Access Token and Refresh Token
6:47
LinuXamination
Рет қаралды 30 М.
Managed Identities with Azure AD (Active Directory) Tutorial
31:54
Adam Marczak - Azure for Everyone
Рет қаралды 141 М.
Getting Started With Azure Key Vault
11:58
Rahul Nath
Рет қаралды 46 М.
Microsoft Azure Overview:  Using Credentials with the Azure SDK
11:23
How to Setup Authentication for Azure Functions
20:44
Azure App Modernization
Рет қаралды 29 М.
КАК ЗАЩИТИТЬСЯ ОТ ГРАБИТЕЛЯ👜
0:43
MEXANIK_CHANNEL
Рет қаралды 1,8 МЛН
Артикул 214546849
0:30
WBUnbox
Рет қаралды 1,4 МЛН
Прогулка под водой #shorts
0:19
Story Time
Рет қаралды 1,5 МЛН
Тот кто не коснется воды - получит приз
0:37
Cat Tommy lost his love…💔 #cat #cats
0:27
Prince Tom
Рет қаралды 138 МЛН