Back to controls

Ensure Azure Key Vaults are used to store secrets

Azure Key Vault will store multiple types of sensitive information, such as encryption keys, certificate thumbprints, and Managed Identity Credentials. Access to these secrets can be controlled through granular permissions.

Category

Controls

Medium

Applies to

Microsoft Azure

Coverage

null controls, 2 queries

Asset types

2 covered

Overview

Azure Key Vault will store multiple types of sensitive information, such as encryption keys, certificate thumbprints, and Managed Identity Credentials. Access to these secrets can be controlled through granular permissions.

Rationale

The credentials given to an application have permission to create, delete, or modify data stored within the systems they access. If these credentials are stored within the application, anyone with access to it or a copy of the code can access them. Storing within Azure Key Vault as secrets increases security by controlling access. This also allows for updates of the credentials without redeploying the entire application.

Impact

References to secrets within the key vault must be specifically integrated within the application code. This will require additional configuration during application writing or refactoring. Additional costs are also charged per 10,000 requests to the Key Vault.

Remediation guidance

For connecting to Azure services, there are more secure ways that do not require secrets.

However, if you need to provide secrets to your web app, we recommend storing them in Azure Key Vault and referencing them. The procedure is relatively simple and well described in the Azure documentation.

In short, you will need to:

  1. Create or use an existing Azure Key Vault.
  2. Add the secrets to the Key Vault.
  3. Grant permission for the Web App to the Key Vault. This implies your web app uses a managed identity (system or user-assigned). You can use the predefined role Key Vault Secrets User for RBAC Key Vaults, or assign Get secrets permissions if using access policies.
  4. Reference the Key Vault secrets from the app settings using the special value @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret) or @Microsoft.KeyVault(VaultName=myvault;SecretName=mysecret)

Azure Portal (Asset-Level)

  1. Open the affected resource from the finding details in Azure Portal.
  2. Navigate to the relevant Security/Configuration/Networking blade.
  3. Apply the control-specific secure setting.
  4. Save and re-run the check.

Multiple Remediation Paths

Azure

SERVICE-WIDE (RECOMMENDED when many resources are affected): Assign Azure Policy initiatives at management group/subscription scope and trigger remediation tasks.

az policy assignment create --name <assignment-name> --scope /subscriptions/<subscription-id> --policy-set-definition <initiative-id>
az policy remediation create --name <remediation-name> --policy-assignment <assignment-id>

ASSET-LEVEL: Apply the resource-specific remediation steps above to the listed non-compliant resources.

PREVENTIVE: Embed Azure Policy checks into landing zones and IaC workflows to block or auto-remediate drift.

References for Service-Wide Patterns

  • Azure Policy overview: https://learn.microsoft.com/en-us/azure/governance/policy/overview
  • Azure Policy remediation: https://learn.microsoft.com/en-us/azure/governance/policy/how-to/remediate-resources
  • Azure Policy initiative structure: https://learn.microsoft.com/en-us/azure/governance/policy/concepts/initiative-definition-structure

Operational Rollout Workflow

Use this sequence to reduce risk and avoid repeated drift.

1. Contain at Service-Wide Scope First (Recommended)

  • Azure: assign policy initiatives at management group/subscription scope and run remediation tasks.
az policy assignment create --name <assignment-name> --scope /subscriptions/<subscription-id> --policy-set-definition <initiative-id>
az policy remediation create --name <remediation-name> --policy-assignment <assignment-id>

2. Remediate Existing Affected Assets

  • Execute the control-specific Console/CLI steps documented above for each flagged resource.
  • Prioritize internet-exposed and production assets first.

3. Validate and Prevent Recurrence

  • Re-scan after each remediation batch.
  • Track exceptions with owner and expiry date.
  • Add preventive checks in IaC/CI pipelines.

Query logic

These are the stored checks tied to this control.

FunctionApps with secrets that are not keyvault references

Connectors

Microsoft Azure

Covered asset types

FunctionApp

Expected check: eq []

{
  functionApps(
    where: {
      applicationConfig: {
        settings_SOME: {
          type: "AppService"
          key_MATCHES: "(.*)(_*?)(key|pass|secret|salt|connectionstring|connection_string)(.*)"
        }
      }
    }
  ) {...AssetFragment}
}
Sites with secrets that are not keyvault references

Connectors

Microsoft Azure

Covered asset types

Site

Expected check: eq []

{
  sites(
    where: {
      applicationConfig: {
        settings_SOME: {
          type: "AppService"
          key_MATCHES: "(.*)(_*?)(key|pass|secret|salt|connectionstring|connection_string)(.*)"
        }
      }
    }
  ) {...AssetFragment}
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon