简体   繁体   中英

Optimization for GetSecret with Azure Keyvault

Our main goal for now is optimising the a processing service. The service has a system-assigned managed identity with accespolicies that allow to get a secret. This service makes 4 calls to a keyvault. The first one takes a lot longer than the others. I'm scratching my head, because the Managed Identity token takes 91µs to obtain. Application Insights image

I changed the way the tokens were obtained. The program only obtains it once and keeps using that same token for other round trips. I did this by making the CredentialClass AddScoped.

I assume the question is why the first call takes more time. If yes, just throwing in a couple of generic reasons which might contribute:

  • HTTPS handshake on the first call might take time
  • The client might need to create a connection pool
  • In case of Azure Key Vault, the first call does two round-trips AFAIK, first for auth, the second for the real payload

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM