Use KeyVault with a Dynamic resourceId
This template creates a SQL Server and uses an admin password from Key Vault. The reference parameter for the Key Vault secret is created at deployment time using a nested template. This allows the user to simply pass parameter values to the template rather than create a reference parameter in the parameter file.
More documentation can be found here.
Tags: Azure Key Vault, Key Vault
Tags: Microsoft.Resources/deployments, Microsoft.Sql/servers