Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously

后端 未结 2 797
谎友^
谎友^ 2021-01-31 00:16

I have setup Azure Keyvault on my ASP.Net MVC web application by following the example in Microsoft\'s Hello Key Vault sample application.

Azure KeyVault (Active Directo

2条回答
  •  甜味超标
    2021-01-31 00:31

    I have the same challenge you have. I am assuming that you've also seen the sample published at https://azure.microsoft.com/en-us/documentation/articles/key-vault-use-from-web-application/

    There is a big difference between what that sample does and what my code does (and I think the intent of your code is). In the sample, they retrieve a secrete and store it in the web application as a static member of their Utils class. Thus, the sample retrieves a secret one time for the entire run time of the application.

    In my case, I am retrieving a different key for different purposes at different times during the application's run time.

    Additionally, the sample download you linked to uses an X.509 certificate to authenticate the web application to KeyVault, rather than client secret. It's possible there is an issue with that too.

    I saw the chat with @shaun-luttin concluding you caused a deadlock, but that's not the whole story I think. I don't use .GetAwaiter().GetResult() or call an async method from a ctor.

提交回复
热议问题