Sitemap

Azure Managed Identity

2 min readApr 19, 2024

--

A decade ago, developers used connection strings, app secrets in the code as configuration files.

Along with advancement in security measures and cloud improvement, then the key-vault was introduced in the year 2015. This gave the place holder for all the secrets to be placed. And the application had the config values to connect to these key vault and get the required secrets/connection string.

This also had the flaw as we need to have the configuration for connecting to azure key vault inside our application repository.

Now this problem has been solved by “Managed Identities in Azure”. Lets explore more on this.

Managed Identity is the service which can be utilized to grant/permit access to to the resources (ex: SQL db) from other resources (ex: web app).

There are two types of Managed Identities in Azure:

  1. System Based Identity
  2. User Based Identity

For the scenarios to explain, we will consider the example of Web App (app service) connecting to the Azure SQL database (SQL db).

Get codewithsachink’s stories in your inbox

Join Medium for free to get updates from this writer.

System Based Identity:

System based identity follows the resource lifecycle.
Sytem based identity

To achieve the same, we need to create the system identity under the identity tab of the resource, in this scenario, for the web app. Then we assign this identity to the SQL db resource, so that it allows this identity to access the resource.

In this case the identity is resource dependent, which means its tightly coupled with azure resource, if the resource is deleted the identity will be deleted too. This is useful in the scenario where there are single instances of the resources which are used to connect.

User Based Identity:

The user based identity is independent of the resources it is attached to.
User based identity

In this case the identity is created and is independent of the resources.This means that we need to create the identity and then assign to all the instances of resources (web servers) using Identity and then grant the access to this identity from the SQL db access control (IAM) tab. With this all the instances of the resources will be able to connect to the SQL db.

Advantages of the Managed Identity:

  • No management of the secrets.
  • Improved Security as there is no storage of any keys.
  • Easy Authentication.
  • Also there is no additional cost for using managed identity.

--

--

codewithsachink
codewithsachink

Written by codewithsachink

Software Developer; keen on learning new things; optimistic on fast tech changes;