LowCodeStacks™
Sign in

Fix "User is not authorized to read secrets" in Key Vault variables

Saving a Secret environment variable fails with "User is not authorized to read secrets". Give you and Dataverse the Key Vault Secrets User role, switch the vault to Azure RBAC, and check the network.

Azure + Power PlatformFix a problem9 min read

Checked against Microsoft Learn 7 sources · Updated By · drafted with AI help, checked by a personHow we write guides

You create an environment variable of type Secret that points at Azure Key Vault, select Save, and Power Apps answers "This variable didn't save properly. User is not authorized to read secrets from" followed by the secret's full path. Power Platform checks, as it saves, that both you and Dataverse can read that secret. The message means one of those checks failed, and the fix is almost always a missing role, the vault's permission model or its firewall.

When you save, change or import an environment variable of type Secret, Power Platform checks that two identities can read the secret in Azure Key Vault: you, the person saving (in a pipeline, the identity it signs in with), and Dataverse, which reads the secret on your behalf. Five things must be true. Each identity needs the Key Vault Secrets User role, because Key Vault Reader can't read secret values. The vault must use Azure role-based access control, because Power Platform checks Azure roles rather than vault access policies. The Microsoft.PowerPlatform resource provider must be registered on the vault's subscription. The network must let Power Platform in: the firewall must allow Power Platform's IP ranges for your region, or a private endpoint must be in the environment's region. And the vault must be in the same Microsoft Entra tenant as the environment. If all are true, the variable saves and holds a reference to the secret. If any one is missing, Power Apps says the variable didn't save properly because the user is not authorized to read secrets.
The variable saves only when you and Dataverse can both read the secret, which needs all five of these to be true.

When it happens

The same check runs in three places, so the error can appear in any of them:

  • creating a new environment variable with Data Type set to Secret and Secret Store set to Azure Key Vault;
  • changing the Key Vault reference of an existing one;
  • importing a solution that contains one, for example into a test or production environment.

The path in the message tells you exactly which subscription, resource group, vault and secret Power Platform tried to read. Copy it: you'll need the vault name and resource group below. Behind the message, Key Vault refused the getSecret action with a 403 (Forbidden), which is a permissions answer, not a sign that the secret is missing.

Work through it

Do the steps in order and try saving again after each one. Role changes can take a few minutes to apply, so wait before deciding a step didn't work. You need the Owner or User Access Administrator role on the vault to add role assignments.

Give Dataverse the Key Vault Secrets User role

Dataverse reads the secret on your behalf, so its own identity needs permission to read secret values.

  1. In the Azure portal, open the key vault and select Access control (IAM).
  2. Select Add, then Add role assignment.
  3. On Role, choose Key Vault Secrets User.
  4. On Members, choose Select members and search for Dataverse. If several Dataverse identities appear, select them all.
  5. Select Review + assign.

What the Role tab shows, as of February 2026:

  1. Role, Members, Conditions and Review + assign: the tabs of Add role assignment, opened here from the vault's Access control (IAM).
  2. The search box on Job function roles: type Key Vault Secrets User to narrow the list.
  3. Key Vault Secrets User: "Read secret contents. Only works for key vaults that use the 'Azure role-based access control' permission model." Select its row, then Next.
  4. Key Vault Certificate User and Key Vault Data Access Administrator match the search too; their descriptions show they read certificates or manage role assignments, not secrets.
The Add role assignment page in the Azure portal, opened from the key vault lcs-kv-prod's Access control (IAM). Its tabs are Role, Members (marked with a dot), Conditions (greyed out) and Review + assign, and Role is open. Below the sentence about role definitions is a button, Copilot can help pick role. On the Job function roles tab, the search box holds Key Vault Secrets User, beside the filters Type : All and Category : All. Three built-in roles match, each with a View link: Key Vault Certificate User, Read certificate contents, category None; Key Vault Data Access Administrator, Manage access to Azure Key Vault by adding or removing role assignments, category None; and, selected, Key Vault Secrets User, Read secret contents. Only works for key vaults that use the 'Azure role-based access control' permission model, category Security. The list says Showing 1 - 3 of 3 results. At the bottom, Review + assign and Previous are unavailable and Next is available.
Recreated by LowCodeStacks from Microsoft Learn screenshots (CC BY 4.0): the Role tab of Add role assignment on a key vault in the Azure portal, interface as of February 2026, with made-up names.

Microsoft's setup page adds a check: open each Dataverse entry in the vault's role assignments, and keep the one whose application ID is 00000007-0000-0000-c000-000000000000. Remove the others from this vault.

Give yourself the same role

The person who creates, changes or imports the variable needs Key Vault Secrets User on the vault too. Repeat the steps above and choose that user under Members. In a pipeline that imports solutions, that's the identity the pipeline signs in with.

Switch the vault to Azure RBAC

Power Platform checks Azure role assignments, even when the vault uses the older Vault access policy model. On such a vault the check can fail although the access policies look right.

  1. Give every user and app that reads this vault an Azure role first, matching what its access policy allowed. Access policies stop applying once the vault switches, so anything you skip loses access.
  2. In the key vault, open Settings > Access configuration. Microsoft's migration page puts the same setting under Settings > Properties, so look there if your portal shows it.
  3. Under Permission model, choose Azure role-based access control and save.
  4. Check that you and Dataverse both have Key Vault Secrets User, then test the apps that use the vault.

Changing the permission model needs the Owner role on the vault, or User Access Administrator together with Key Vault Contributor. Contributor alone isn't enough, because it can't assign roles.

Register the Microsoft.PowerPlatform resource provider

Power Platform can only work with resources in a subscription that has its resource provider registered.

  1. In the Azure portal, open Subscriptions and select the vault's subscription.
  2. Select Resource providers and search for Microsoft.PowerPlatform.
  3. If it shows NotRegistered, select it and choose Register.

Check the network and the tenant

  • Firewall: if the vault allows only selected networks, add the Power Platform IP address ranges for your region (see Sources). The Allow trusted Microsoft services to bypass this firewall option doesn't cover Power Platform.
  • Private endpoint: with Virtual Network support for Power Platform, the vault's private endpoint must be in the same region as the environment, in the subnet delegated to Power Platform, with private DNS integration on. If your enterprise policy delegates subnets in two regions, create an endpoint in each. Virtual Network support needs a Managed Environment.
  • Tenant: the vault must be in the same Microsoft Entra tenant as the environment. A vault in another tenant can't be used; move the secret to a vault in the right tenant.

Check everything with the Azure CLI

These commands only read settings, so they're safe to run first. Replace the vault and resource group names, then compare the output with the comments.

bash
vault="kv-contoso-flows"
rg="rg-power-platform"
scope=$(az keyvault show --name "$vault" --resource-group "$rg" --query id -o tsv)

# Azure RBAC on? Expect: true
az keyvault show --name "$vault" --resource-group "$rg" --query properties.enableRbacAuthorization

# Who can read secret values? Expect your account and Dataverse in the list.
az role assignment list --scope "$scope" --role "Key Vault Secrets User" \
  --query "[].{who:principalName, type:principalType}" -o table

# Resource provider registered? Expect: Registered
az provider show --namespace Microsoft.PowerPlatform --query registrationState -o tsv

# Firewall? "Deny" means only the networks listed on the vault get in.
az keyvault show --name "$vault" --resource-group "$rg" --query properties.networkAcls.defaultAction

If something is missing, these make the changes. Run the role assignments before switching the permission model.

bash
dataverse=$(az ad sp show --id 00000007-0000-0000-c000-000000000000 --query id -o tsv)
me=$(az ad signed-in-user show --query id -o tsv)

az role assignment create --role "Key Vault Secrets User" \
  --assignee-object-id "$dataverse" --assignee-principal-type ServicePrincipal --scope "$scope"
az role assignment create --role "Key Vault Secrets User" \
  --assignee-object-id "$me" --assignee-principal-type User --scope "$scope"

az provider register --namespace Microsoft.PowerPlatform
az keyvault update --name "$vault" --resource-group "$rg" --enable-rbac-authorization true

Why Key Vault Reader isn't enough

Older setup instructions asked for Key Vault Reader. That role can see that a secret exists and read its details, but not its value. Key Vault Secrets User is the role that reads secret contents, and Power Platform now checks for it. If your vault was set up with the old instructions, add Key Vault Secrets User for you and for Dataverse; you can keep or remove Key Vault Reader.

Where the secret can be used

Once it saves, the environment variable holds a reference to the secret, not the secret itself. You can use it in Power Automate flows and custom connectors. Other parts of Power Platform, and the Dataverse API, don't return it, and it doesn't appear in a flow's dynamic content list. Microsoft suggests a separate vault for each environment, so a problem in one can't expose the others.

Sources

Add LowCodeStacks as a preferred source on Google

Did this fix it?

Get the weekly email

New guides and updates from LowCodeStacks, every Tuesday. One email a week, no more.

From LowCodeStacks, Regina, SK, contact@lowcodestacks.com. You can unsubscribe any time, from the link in every email or in your privacy settings. See the Privacy notice.

Comments

No comments yet. Share what worked for you.

Sign in to comment. Comments show under a display name you choose, never your email.