一键导入
preflight-safety
Deterministic procedure to evaluate ARG health preconditions before an ARM deployment and emit a fixed-format preflight-results report.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deterministic procedure to evaluate ARG health preconditions before an ARM deployment and emit a fixed-format preflight-results report.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deterministic procedure to watch an ARM deployment, evaluate a health gate, and automatically cancel + redeploy the last-known-good template on breach.
Deterministic procedure to find tag-non-compliant Azure resources, emit a fixed-format report, and (on explicit authorisation) deploy ARM patches to apply missing tags.
Deterministic procedure to inspect an ARM template, cross-reference affected resources via ARG, categorize each change, flag policy violations and dependency fan-out, and emit a fixed-format risk report.
Deterministic procedure to surface top cost-driving resources by querying ARG for new/resized resources in a time window, joined with owner tags, and emit a fixed-format markdown report.
Deterministic procedure to provision, monitor, and cancel pre-approved ARM golden-path template deployments with naming guardrails, tag enforcement, and compliance checks.
Deterministic procedure to compare a checked-in ARM template with live Azure state and emit a property-level drift report in markdown + JSON patch (RFC 6902) format.
| name | preflight-safety |
| description | Deterministic procedure to evaluate ARG health preconditions before an ARM deployment and emit a fixed-format preflight-results report. |
Inputs:
scope: name of a runbook under runbooks/<scope>.yaml. Defaults to prod.verb: one of preflight (default), deploy, status.template_file: path to the ARM template file to deploy (required for deploy verb).parameters_file: path to the ARM parameters file (required for deploy verb).runbooks/<scope>.yaml as raw text. If a sibling runbooks/<scope>.values.yaml
exists, parse it and substitute every ${key} token in the runbook text with the
corresponding value. Then parse the substituted text as YAML. If
<scope>.values.yaml is missing, abort with the literal message:
ABORT: runbooks/<scope>.values.yaml missing — copy <scope>.values.yaml.example and fill in real values.subscriptions[]rg_include[], rg_exclude[]deployment_target_rg (resource group for the deploy)preflight_rules_per_env (map of env name → list of rule_ids to run; defaults to all rules)force_deploy_flag (boolean; default false)preflight_timeout_seconds (integer; default 30)quota_limits (map for R005 comparison; see ratification #6)skills/preflight-safety/rules/rules.yaml. Compute SHA-256 of the file
contents; keep first 8 hex chars as ruleset_hash8.run_id = "PRE-" + UTC date YYYYMMDD + "-" + scope + "-" + ruleset_hash8.preflight_rules_per_env[scope] is set, use that
list; otherwise use all rules in file order. Sort the active list by rule_id
ascending (R001, R002, … R009).start_time in UTC.For each rule in the active rule list in rule_id order:
(now - start_time) >= preflight_timeout_seconds, record
all remaining rules as STATUS=TIMEOUT and break out of the loop.rule.kql is missing → record STATUS=SKIPPED REASON=no-kql and continue.validate_query with query = rule.kql, subscriptions = runbook.subscriptions.
STATUS=INVALID, store error message, continue to next rule.execute_query with the same arguments.
skip_if_unavailable: true AND the response is an error containing
"table not found" / "table unavailable" OR the result set is empty with an
error indicator → record STATUS=SKIPPED REASON=<error> and continue.STATUS=PASSSTATUS=FAIL, store failing_resource_count and
up to the first 25 id values.currentCount per (subscriptionId, location, resourceType)
against the matching entry in runbook.quota_limits. If currentCount >= quota_limit * 0.9 (90 % threshold) → FAIL. If quota_limits not configured →
SKIPPED.(rule_id, title, severity, status, failing_resource_count, remediation_hint).checks_pass = count of PASSchecks_fail = count of FAILchecks_skip = count of SKIPPED + INVALID + TIMEOUTchecks_fail == 0 → decision = PASS — DEPLOY ALLOWEDchecks_fail > 0 AND runbook.force_deploy_flag == false →
decision = FAIL — DEPLOY BLOCKEDchecks_fail > 0 AND runbook.force_deploy_flag == true →
decision = FORCE — DEPLOY WITH AUDIT WARNING
Emit: ⚠️ AUDIT WARNING: force_deploy_flag=true overrides ${checks_fail} FAIL(s).
Write a timestamped audit entry to exports/audit-<run_id>.md (see Step 4 c).preflighttemplates/output-preflight-results.md.{{run_id}}, {{scope}}, {{generated_utc}}, {{ruleset_hash8}},
{{preflight_timeout_seconds}}, {{checks_pass}}, {{checks_fail}},
{{checks_skip}}, {{decision}}{{preflight_results_table}} — one row per rule in rule_id order with columns:
Rule ID | Title | Severity | Status | Failing Resources | Remediation Hintdeploypreflight step has already been run this session, or re-run it.FAIL — DEPLOY BLOCKED → print the block message and stop.
Do not proceed with deployment.PASS or FORCE:
templates/output-report.md.{{run_id}}, {{scope}}, {{generated_utc}},
{{decision}}, {{template_file}}, {{parameters_file}},
{{deployment_target_rg}}, {{preflight_results_table}}.create_template_deployment — render the outcome locally.Write exports/audit-<run_id>.md:
# Audit Entry — Force Deploy
run_id: <run_id>
timestamp_utc: <generated_utc>
scope: <scope>
force_deploy_flag: true
checks_fail_count: <checks_fail>
justification: <user-supplied justification from prompt>
failed_rules: <comma-separated list of FAIL rule_ids>
statusget_arm_template_deployment_status with the deployment name from the last
deploy run (stored in context or passed as input).deployment_name, status, timestamp, error (if any).INVALID with the timeout error and continue.rules.yaml cannot be read, abort: ABORT: rules.yaml unreadable.preflight_timeout_seconds budget is exhausted, mark remaining rules TIMEOUT
and emit a budget-exceeded warning in the report.# Pre-flight Deployment Safety Check.exports/.