Connect one storage account to multiple Azure functions

Debashis Jena 71 Reputation points
2023-06-14T11:52:49.05+00:00

Hi,

We have four Azure functions(3 CosmosDB Trigger, IoTHub Trigger). Can we connect one storage account in all the functions.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,351 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,338 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tulika Priyadarshini 165 Reputation points Microsoft Employee
    2023-06-14T16:48:11.79+00:00

    It's possible for multiple function apps to share the same storage account without any issues. For example, in Visual Studio you can develop multiple apps using the Azurite storage emulator. In this case, the emulator acts like a single storage account. The same storage account used by your function app can also be used to store your application data. However, this approach isn't always a good idea in a production environment.

    https://learn.microsoft.com/en-us/azure/azure-functions/storage-considerations?tabs=azure-cli#shared-storage-accounts

    0 comments No comments

  2. SnehaAgrawal-MSFT 22,166 Reputation points
    2023-06-20T08:50:14.8666667+00:00

    @Debashis Jena

    Thanks for reaching here! To add on further here-

    It is recommended to use a separate storage account for each function app, especially when you have Durable Functions or Event Hub triggered functions, which both generate a high volume of storage transactions. When your application logic interacts with Azure Storage, either directly (using the Storage SDK) or through one of the storage bindings, you should use a dedicated storage account.

    See- https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices?tabs=csharp#storage-account-configuration

    However, if you still want to use the same storage account for all your functions, you can do so by specifying the same storage account connection string in the application settings of all your functions.

    But keep in mind that this can lead to performance issues and may not be the best practice.

    Hope this helps.

    Please accept as "Yes" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.