一键导入
bicep
Creates bicep files (.bicep) from instructions according to best practices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates bicep files (.bicep) from instructions according to best practices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | bicep |
| description | Creates bicep files (.bicep) from instructions according to best practices. |
| allowed-tools | WebFetch, WebSearch, Edit, Write, Read, Bash |
When writing bicep files (.bicep) follow best practices to ensure templates are easy to read, maintain, and deploy.
Follow this workflow when writing bicep files:
Understand the requirements: Before writing any code, make sure you have a clear understanding of the requirements and the resources that need to be deployed. Ask questions to clarify any uncertainties.
Plan the structure: Decide on the structure of your bicep file, any relationship to existing Bicep files and how you will organize parameters, variables, resources, and outputs.
Write the code: Start writing the bicep code, following the best practices outlined below.
Validate the bicep file: After writing the code, you MUST run the following validation steps:
Run Bicep Build: Execute bicep build "<filepath>" to validate the bicep file and capture linter warnings (linting is automatically included in the build process)
Fix any syntax errors immediately
Address critical linter warnings (secure parameter defaults, etc.)
Clean up JSON files: Delete the generated JSON file after validation to avoid bloating the workspace:
rm "<filepath without .bicep>.json"
Create test parameters (if needed): If the bicep file has required parameters without defaults (especially @secure parameters):
Create a temporary .bicepparam file with test values (e.g., <filename>.test.bicepparam)
This allows PSRule to properly expand and validate the template
Clean up the test parameter file after validation to avoid confusion:
rm "<filename>.test.bicepparam"
Run PSRule: Execute PSRule against the specific bicep file (not the entire directory) to check for Azure best practice compliance. Use summary output to avoid context bloat:
pwsh -Command "Invoke-PSRule -InputPath '<filepath>' -Module PSRule.Rules.Azure -Outcome Fail -As Summary -Option '<ps-rule.yaml>'"
Categorize and address issues: After validation, group PSRule findings into:
Then:
Iterate: Apply fixes based on user selections and re-run validation until clean or user decides to stop.
Example workflow:
bicep build → Fix any linter errors → Clean up generated JSON file"I found several best practice improvements. Would you like to address them?"
- Security Hardening (2 issues): Restrict NSG rules, remove public IP
- High Availability (1 issue): Add availability zones
- Monitoring (2 issues): Add Azure Monitor Agent, maintenance config
- Skip all improvements
Follow these best practices writing bicep files:
uniqueString() function is useful for creating unique resource names. Use the uniqueString() function to generate part of the resource name. In most situations, the fully qualified resource group ID is a good option for the seed value for the uniqueString, for example:var uniqueNameComponent = uniqueString(resourceGroup().id)
Prepend or append meaningful information to ensure your resources are easily identifiable.
Use lower camel case for names, such as myVariableName or myResource.
It's a good practice to use template expressions to create resource names, like in this example:
param shortAppName string = 'toy'
param shortEnvironmentName string = 'prod'
param appServiceAppName string = '${shortAppName}-${shortEnvironmentName}-${uniqueString(resourceGroup().id)}'
resource cosmosDBAccount not this resource cosmosDBAccountName.reference and resourceId functions in your Bicep file.parent property or nesting.