Azure Managed Identity for Azure resources and Azure VMs

Azure Managed Identity for Azure resources and Azure VMs

Adding system-managed identity to Azure resources is a straight forward activity: assign the managed identity to a resource and provide permission for this identity to the protected resource.

I am exemplifying here with an Azure function accessing Azure SQL using managed identity.

The Azure function's code required for this to work it is displayed below:

Azure function with managed identity

You need to add the following roles in the Azure SQL database:

Setting up managed identity permissions in Azure SQL Server

Running the Azure function will show that it can read and print information from the database.

Azure function executed and printing database's data

A more interesting exercise is to configure Azure VMs and set them up to have the code running on them access a SQL Server database located on a different VM in Azure.

This is possible when running a SQL Server 2022 database.

The screen from below shows how this works:

The VM managed identity in Azure
The SQL Server 2022 Profiler showing the application accessing the database using the managed identity.

Another way to test this connection:

Note that a single day of work configuring all the resources in Azure cost you around 40$

If you want to learn more about how to configure the whole implementation with VMs, please feel free to contact me on LinkedIn or on my email at: efrunza@hotmail.com


Adinel Gavrus

Assoc. Prof. Habil. Dr. (Enseignant-Chercheur, Ma?tre de Conferences des Univ. HDR HC Titulaire), INSA Rennes, France

4 个月

Beautiful offre the recognized intelligent nature...

赞
回复

要查看或添加评论,请登录

Eugen Frunza的更多文章

社区洞察

其他会员也浏览了