I am working on an application which centers around a function app which interfaces with a handful of resources. These resources all have their own keys and connection strings, which are stored in a key vault. The function app accesses the key vault’s contents with a managed identity.
I would like to minimize the amount of future administrative work caused by having to regenerate those keys and putting the new values into the vault. For storage accounts, I know I could automate this entirely by making it a key vault managed account, but AFAIK there is no such feature for things like CosmosDB or OpenAI services. I know I could set up another function app to perform rotations for me like this, but I’m on a bit of a timeline and would prefer not to deal with all the debugging if possible. Do I have any other options?
2
Answers
Automating key and connection string rotations for resources such as CosmosDB or OpenAI services is feasible, even without native support for key vault managed identities, as there are a few alternatives available.
Considering your goal to reduce administrative overhead and manual intervention in the future, it would be beneficial to utilize the existing services and features of Azure that are designed to streamline this process.
Azure Key Vault Managed Account:
Automated Key Rotation Function App:
Customer-Managed Keys for Cosmos DB:
Consider using Entra ID authentication for OpenAI services, explore the automated function app approach, and take advantage of CMK for Cosmos DB.
Ref: https://learn.microsoft.com/en-us/azure/cosmos-db/store-credentials-key-vault
https://azure.microsoft.com/en-us/updates/public-preview-configure-customermanaged-keys-on-existing-cosmos-db-accounts/
If it is all Azure resources there should not be a reason why you can’t do all of this with managed identity. Cosmos DB is well-documented. For storage, are you using blob storage or file shares? If you are mapping file shares you may not be able to do without the storage account key but otherwise, I think all of this is doable with managed identity. If you have specific questions about how to do that don’t hesitate to ask.