Error BCP109: The type "Microsoft.KeyVault/vaults/secrets" does not contain function "getSecret"

Occasional Contributor

Hi, I am trying to pass the secret value as a secure parameter to a Bicep module, but I am getting the error: Error BCP109: The type "Microsoft.KeyVault/vaults/secrets" does not contain function "getSecret".

Code in main. Bicep file

resource myVaultSecret 'Microsoft.KeyVault/vaults/secrets@2023-02-01' existing = {

  name: 'myVault/mySecret'
module sqlModule 'sqlserver-module.bicep' = if (databaseService == 'sql') {
  name: 'sqlDeployment'
  params: {
    administratorLogin: administratorLogin
    administratorLoginPassword: myVaultSecret.getSecret('mySecret')
    location: location
    resourceGroup: resourceGroup
    serverName: serverName
    servicePlanSku: servicePlanSku
    sqlDBName: databaseName
    subcription: subscription
    tags: tags
    workloadEnv: workloadEnv
#end main.bicep
code sqlserver-module.bicep file
@description('The administrator password for the SQL server.')
param administratorLoginPassword string
Any help will be appreciated !!
1 Reply
Perhaps I'm wrong, but I do not publicly see an API version 2023-02-01 for the Microsoft.KeyVault resource type, Regardless, in my case, this example worked for me HTH.