Skip to main content

lacework-global-582

9.5 Enable Register with Azure Active Directory on App Service (Automated)

Profile Applicability

• Level 1

Description

Managed service identity in App Service provides more security by eliminating secrets from the app, such as credentials in the connection strings. When registering with Azure Active Directory in App Service, the app connects to other Azure services securely without the need for usernames and passwords.

Rationale

App Service provides a highly scalable, self-patching web hosting service in Azure. It also provides a managed identity for apps, which is a turn-key solution for securing access to Azure SQL Database and other Azure services.

Audit

From Azure Portal

  1. From Azure Portal open the Portal Menu in the top left
  2. Go to App Services
  3. Click on each App
  4. Under the Setting section, Click on Identity
  5. Under the System assigned pane, ensure that Status set to On

From Azure CLI

To check Register with Azure Active Directory feature status for an existing app, run the following command,

az webapp identity show --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --query principalId

The output should return unique Principal ID. If no output for the above command then Register with Azure Active Directory is not set.

From Azure PowerShell

List the web apps.

Get-AzWebApp

For each web app run the following command.

Get-AzWebapp -ResourceGroupName <app resource group> -Name <app name>

Make sure the Identity setting contains a unique Principal ID

Remediation

From Azure Portal

  1. Login to Azure Portal using https://portal.azure.com.
  2. Go to App Services.
  3. Click each App.
  4. Under Setting section, click Identity.
  5. Under the System assigned pane, set Status to On.

From Azure CLI

To set Register with Azure Active Directory feature for an existing app, run the following command:

az webapp identity assign --resource-group <resource_group_name> --name <app_name>

From Azure PowerShell

To register with Azure Active Directory feature for an existing app, run the following command:

Set-AzWebApp -AssignIdentity $True -ResourceGroupName <resource_Group_Name> -Name <App_Name>

References

https://docs.microsoft.com/en-gb/azure/app-service/app-service-web-tutorial-connect-msi
https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-identity-management#im-1-use-centralized-identity-and-authentication-system