azure-deployment-preflight
它能做什么
检查你用于部署到 Azure 的配置文件是否正确,然后再真正做出任何改动。它会检查拼写错误,显示将会发生哪些变化,并确认你是否有相应的权限。
适用场景
- ✓在向 Azure 部署新服务之前。
- ✓当你审查配置文件中的改动时。
- ✓为了确认你有部署所需的权限。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/azure-deployment-preflight/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我检查一下我的 Bicep 文件在 Azure 部署方面是否有问题。”
每周 5 个新技能,1 分钟读完。
工作原理
它会先判断你使用的是 Azure Developer CLI 还是普通的 Azure CLI。然后检查文件的语法,并模拟一次部署,展示将会发生什么,以及是否存在问题。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Azure Deployment Preflight Validation
This skill validates Bicep deployments before execution, supporting both Azure CLI (az) and Azure Developer CLI (azd) workflows.
When to Use This Skill
- Before deploying infrastructure to Azure
- When preparing or reviewing Bicep files
- To preview what changes a deployment will make
- To verify permissions are sufficient for deployment
- Before running
azd up,azd provision, oraz deploymentcommands
Validation Process
Follow these steps in order. Continue to the next step even if a previous step fails—capture all issues in the final report.
Step 1: Detect Project Type
Determine the deployment workflow by checking for project indicators:
Check for azd project: Look for
azure.yamlin the project root- If found → Use azd workflow
- If not found → Use az CLI workflow
Locate Bicep files: Find all
.bicepfiles to validate- For azd projects: Check
infra/directory first, then project root - For standalone: Use the file specified by the user or search common locations (
infra/,deploy/, project root)
- For azd projects: Check
Auto-detect parameter files: For each Bicep file, look for matching parameter files:
<filename>.bicepparam(Bicep parameters - preferred)<filename>.parameters.json(JSON parameters)parameters.jsonorparameters/<env>.jsonin same directory
Step 2: Validate Bicep Syntax
Run Bicep CLI to check template syntax before attempting deployment validation:
bicep build <bicep-file> --stdout
What to capture:
- Syntax errors with line/column numbers
- Warning messages
- Build success/failure status
If Bicep CLI is not installed:
- Note the issue in the report
- Continue to Step 3 (Azure will validate syntax during what-if)
Step 3: Run Preflight Validation
Choose the appropriate validation based on project type detected in Step 1.
For azd Projects (azure.yaml exists)
Use azd provision --preview to validate the deployment:
azd provision --preview
If an environment is specified or multiple environments exist:
azd provision --preview --environment <env-name>
For Standalone Bicep (no azure.yaml)
Determine the deployment scope from the Bicep file's targetScope declaration:
| Target Scope | Command |
|---|---|
resourceGroup (default) |
az deployment group what-if |
subscription |
az deployment sub what-if |
managementGroup |
az deployment mg what-if |
tenant |
az deployment tenant what-if |
Run with Provider validation level first:
# Resource Group scope (most common)
az deployment group what-if \
--resource-group <rg-name> \
--template-file <bicep-file> \
--parameters <param-file> \
--validation-level Provider
# Subscription scope
az deployment sub what-if \
--location <location> \
--template-file <bicep-file> \
--parameters <param-file> \
--validation-level Provider
# Management Group scope
az deployment mg what-if \
--location <location> \
--management-group-id <mg-id> \
--template-file <bicep-file> \
--parameters <param-file> \
--validation-level Provider
# Tenant scope
az deployment tenant what-if \
--location <location> \
--template-file <bicep-file> \
--parameters <param-file> \
--validation-level Provider
Fallback Strategy:
If --validation-level Provider fails with permission errors (RBAC), retry with ProviderNoRbac:
az deployment group what-if \
--resource-group <rg-name> \
--template-file <bicep-file> \
--validation-level ProviderNoRbac
Note the fallback in the report—the user may lack full deployment permissions.
Step 4: Capture What-If Results
Parse the what-if output to categorize resource changes:
| Change Type | Symbol | Meaning |
|---|---|---|
| Create | + |
New resource will be created |
| Delete | - |
Resource will be deleted |
| Modify | ~ |
Resource properties will change |
| NoChange | = |
Resource unchanged |
| Ignore | * |
Resource not analyzed (limits reached) |
| Deploy | ! |
Resource will be deployed (changes unknown) |
For modified resources, capture the specific property changes.
Step 5: Generate Report
Create a Markdown report file in the project root named:
preflight-report.md
Use the template structure from references/REPORT-TEMPLATE.md.
Report sections:
…
常见问题
什么是 Bicep 文件?
它是一种描述你想在 Azure 中创建或管理的资源的文件,比如虚拟机或数据库。
什么是“what-if”?
这是一种模拟操作,会在部署命令真正运行之前,展示它将做出的改动。
如果我没有权限,会怎样?
工具会提醒你可能缺少必要的权限,并尝试在信息较少的情况下继续检查。
详情
作者的原始描述
Performs comprehensive preflight validation of Bicep deployments to Azure, including template syntax validation, what-if analysis, and permission checks. Use this skill before any deployment to Azure to preview changes, identify potential issues, and ensure the deployment will succeed. Activate when users mention deploying to Azure, validating Bicep files, checking deployment permissions, previewi
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7080
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。