Taiob Ali shows how you can safely store credentials which your Azure Function apps need:
With the announcement of Powershell support in Azure Functions, it has become easier for data professionals to use functions to manage cloud resources such as Azure SQL Database, Managed Instances. A common challenge when using functions is how to manage the credentials in function code for authenticating databases. Keeping the credentials secure is an important task. Ideally, the credentials should never appear in the code or in the source control.
Manged Identity can solve this problem as Azure SQL Database and Managed Instance both support Azure AD authentication. You can read mode about Managed Identity here.
In this article, I will show how to set up Azure Function App to use Managed Identity to authenticate functions against Azure SQL Database.
The example connects Azure SQL DB, but this is a general-purpose solution.