Using managed identities
Many resources in Azure can have identities attached to them, and we can use those identities to provide access to other Azure services without the need for passwords and usernames.
Managed identities are a special type of account called a service principal, and as they are managed, it means we never have to see the details – Azure just manages them for us.
Managed identities are arguably the most secure method of providing access between components as we never have to record sensitive passwords anywhere.
When we created our SQL Server, we chose Use both SQL and Azure AD Authentication. The AD part is important when using managed identities because, under the hood, they are just Active Directory accounts.
We also need to enable our web app with an identity, which we did in the previous section when we set up the Key Vault. Therefore, all we need to do now is grant access to that account to SQL Server. We must do that by using T-SQL commands...