What is best practice for a Functions App to update a Cosmos NoSQL container configuration?
Much more details here: https://stackoverflow.com/questions/79325429/azure-functions-app-cannot-update-cosmos-db-container-configuration-using-ihoste
Essentially in my app service plan I made a Functions app that uses IHostedService added to the service configuration. The application starts with await host.RunAsync()
which kicks off the StartAsync()
of the DatabaseInitializerService
My application is connected to the cosmos db in azure and can read and write to it. It has contributor access.
When I run locally with the Cosmos DB Emulator I can see that the function is able to mutate the indexing policy and TTL settings on the Cosmos DB container. In azure this does not happen.
What could be the cause? If using IHostedService StartAsync to do these kinds of DB updates is bad practice, what's better practice for a Functions app updating its container configurations?
In my role I don't have access to Terraform and I have very limited access to Azure itself when it comes to write permissions in Azure Portal. The SDK must have a best practice since it has the public methods available.