Fetch secret from existing kv using msi #3618
-
Hi resource kv 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: kvName
scope: resourceGroup(subscription().subscriptionId, resourceGroup().name)
}
module getKv '../secrets/kv.bicep' = {
name: 'kvfetch'
params: {
myPassword: kv.getSecret('wintenstorage')
}
} thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Only a few specific resources E.g. Application Gateway support this, however those have implemented on the Application Gateway itself, since it can be assigned with a System OR User Assigned Managed Identity, which is delegated Certs/Secrets/Get via RBAC or Access Policy to the Keyvault to pull a certificate Etc. Currently the only way to access secrets via a 'Deployment' is with parameters, which will have the `@secure' decorator. e.g. So what you have in your kv.bicep Module file. @secure()
param myPassword string However that will be accessed under the permissions of the account that runs the Deployment. it should just need RBAC or Access Policy assigned to get secrets, plus action: The account that is running the deployment could be either a: User, A Service Principal or Managed Identity, that is logged into the AZ cli or AZ PowerShell. However there is no way to deploy as the user, then access the vault via a different context, such as Managed Identity. |
Beta Was this translation helpful? Give feedback.
Only a few specific resources E.g. Application Gateway support this, however those have implemented on the Application Gateway itself, since it can be assigned with a System OR User Assigned Managed Identity, which is delegated Certs/Secrets/Get via RBAC or Access Policy to the Keyvault to pull a certificate Etc.
Currently the only way to access secrets via a 'Deployment' is with parameters, which will have the `@secure' decorator.
e.g. So what you have in your kv.bicep Module file.
However that will be accessed under the permissions of the account that runs the Deployment. it should just need RBAC or Access Policy assigned to get secrets, plus action:
MI…