Skip to content

How to retrieve keyvault secret in a module bicep #5507

Answered by Dnelre
Dnelre asked this question in Q&A
Discussion options

You must be logged in to vote

The solution used is generating a secret before bicep deployment and passing the secret via parameter in main bicep.


@secure()
param adminPassword 

module kv './modules/keyvault.bicep' = {     
  name: '${deployment().name}-kv'     
  scope: rg     
  params: {     
    keyvaultName: kvName    
    adminPassword: adminPassword    
  }     
}  

module vm './modules/vm.bicep' = {     
  name: '${deployment().name}-vm-${vm.hostShortName}'     
  scope: rg     
  params: {     
    adminPassword: adminPassword 
    adminUsername: 'localadmin'     
  }     
  dependsOn: [     
    network     
    kv     
  ]     
} 

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@Dnelre
Comment options

@Dnelre
Comment options

@brwilkinson
Comment options

Comment options

You must be logged in to vote
4 replies
@brwilkinson
Comment options

@moha999
Comment options

@moha999
Comment options

Answer selected by Dnelre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants