Bicep extension to generate complex passwords with PassWordGenerator

January 24, 2026 ยท View on GitHub

Extension to bicep that allow to generete complex password and pass to resources

Usage

To use the extension, make sure you add the bicepconfig.json file and PassWordGenerator:

// bicepconfig.json
{
  "experimentalFeaturesEnabled": {
    "localDeploy": true,
    "extensibility": true
  },
  "cloud": {
    "credentialPrecedence": [
      "AzurePowerShell",
      "AzureCLI"
    ],
    "currentProfile": "AzureCloud"
  },
  "extensions": {
    "PassWordGenerator": "br:bicepextsys4opsacr.azurecr.io/extensions/passwordgenerator:0.2.0"
  },
  "implicitExtensions": []
}

Note

See the CHANGELOG.md file for available version and updates.

// main.bicep
targetScope = 'local'

resource password 'GeneratedPassword' = {
  name: 'myPassword'
  properties: {
    includeLower: true // Password should include lower character - default true
    includeUpper: true // Password should include lower character - default true
    includeDigits: true // Password should include Digits - default true
    includeSpecial: false // Password should include special character like "!@#$%^&*()-_=+[]{}|;:,.<>?/" - default true
    passwordLength: 50 // Password length - defaul id 16
  }
}

output password string = password.output

Build and test locally

To execute the all operations, make sure you have:

  • .NET SDK v9.0 installed
  • Bicep CLI v0.37.4 or higher
  • An Azure subscription

Build locally


# macOS Apple Silicon
dotnet publish -c Release -r osx-arm64 --self-contained true /p:PublishSingleFile=true

# Linux x64
dotnet publish -c Release -r linux-x64 --self-contained true /p:PublishSingleFile=true

# Windows x64
dotnet publish -c Release -r win-x64   --self-contained true /p:PublishSingleFile=true

Pack the Extension

Run bicep publish-extension to bundle all RIDs into one file

bicep publish-extension \
  --bin-osx-arm64   ./bin/Release/osx-arm64/publish/PassWordGenerator \
  --bin-linux-x64   ./bin/Release/linux-x64/publish/PassWordGenerator \
  --bin-win-x64     ./bin/Release/win-x64/publish/PassWordGenerator.exe \
  --target          ./bin/PassWordGenerator \
  --force

Deploy locally

bicep local-deploy main.bicepparam