create-workspace
Provision a Microsoft.Chaos/workspaces resource (v2), bind a managed identity, set scopes, and grant Reader RBAC on the scope.
- License 许可
- MIT
- 最近更新
- 2026-10-28
- Stars
- ★ 3
- Forks
- 4
01 前言 Front Matter
- name
- create-workspace
- description
- Provision a Microsoft.Chaos/workspaces resource (v2), bind a managed identity, set scopes, and grant Reader RBAC on the scope.
02 资源文件 11
- 参考文档backends/github-releases.md1.4 KB
- 参考文档backends/s3.md1.2 KB
- 参考文档backends/self-hosted.md943 B
- 参考文档backends/svnpubsub.md1.9 KB
- 参考文档blockers/target-exists.md658 B
- 参考文档blockers/trusted-hardware.md926 B
- 参考文档convenience-artefacts.md3.4 KB
- 参考文档outcomes/handoff-non-pmc.md1.1 KB
- 参考文档prerequisites.md987 B
- 参考文档references.md1.8 KB
- 脚本scripts/Invoke-CreateWorkspace.ps18.0 KB
03 SKILL.md 正文
CreateWorkspace — Chaos Studio Workspace Provisioning
⛔ ABSOLUTE RULE: Do NOT improvise, skip, or substitute any step. On ANY error, STOP and wait for the user.
When to use this skill (vs. the MCP server)
This skill is the human-interactive path: it persists state to startchaos-state.json, renders cards, and produces the workspace + identity + Reader RBAC in one go. Use it when there is a user in the loop.
If you are an autonomous agent with no user to prompt, call chaos_create_workspace on the chaos-studio MCP server. Same provisioning + identity binding + Reader RBAC, returned as a single tool call. See mcp/README.md.
Both surfaces target Microsoft.Chaos 2026-05-01-preview and use the local az login session for auth.
How It Works
All provisioning logic lives in scripts/Invoke-CreateWorkspace.ps1. The script handles input validation, workspace creation via az chaos workspace create (the CLI awaits the provisioning LRO), identity resolution, RBAC test/grant, and state persistence.
The AI orchestrator's only job is:
- Set
$env:STARTCHAOS_STATE_PATHto${SESSION_DIR}/startchaos-state.json. - Run the script with the required parameters.
- Handle exit codes that require user input (see below).
- Re-run with the user's answers as parameters.
Prerequisites
state.auth.status == "done"(run auth pre-flight first; the script refuses to start otherwise)state.context.subscriptionIdpopulated
Running the Script
$env:STARTCHAOS_STATE_PATH = "<session-dir>/startchaos-state.json"
& "<skill-dir>/scripts/Invoke-CreateWorkspace.ps1" `
-ResourceGroup <rg> `
-WorkspaceName <name> `
-Scopes @('<arm-id>', ...) `
[-Location <region>] `
[-IdentityType SystemAssigned|UserAssigned] `
[-UserAssignedIdentityResourceId <uami-arm-id>]
Idempotent: re-runs short-circuit when state.workspace.status == "done".
Exit Codes → AI Actions
| Exit | Meaning | AI Action |
|---|---|---|
| 0 | Workspace ready | Done — summary already rendered by script. |
| 1 | Hard error | STOP. Render the error from script output. Wait for user. State has workspace.lastError. |
If a required parameter is missing, PowerShell's parameter binder fails before the script body runs — gather the missing input via ask_user and retry.
Script Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
-ResourceGroup |
yes | — | Azure resource group name |
-WorkspaceName |
yes | — | Name for the workspace resource |
-Scopes |
yes | — | ARM IDs the workspace is allowed to target (subscription / RG / service group) |
-Location |
no | westus2 |
Azure region |
-IdentityType |
no | SystemAssigned |
SystemAssigned or UserAssigned |
-UserAssignedIdentityResourceId |
conditional | — | Required when -IdentityType UserAssigned |
What the Script Handles (no AI logic needed)
- Input validation and ARM-ID well-formedness checks
- Workspace creation via
az chaos workspace create(identity + scopes) - Provisioning LRO awaited by the CLI, with terminal-state surfacing
- Identity resolution (SystemAssigned principalId from response; UserAssigned via UAMI GET)
- Per-scope
Test-CallerCanAssignRoles+ Reader role assignment with remediation card on denial - Atomic state writes with error envelopes
- Idempotent re-runs
Related Skills
start-chaos— orchestrator that invokes this skillsetup-scenario— next phase after workspace creation
04 同仓库更多 Skills
start-chaos
Orchestrate the full Chaos Studio v2 workflow: auth → workspace → scenario → run. Shares a single state file and supports resume.
setup-scenario
Discover recommended scenarios, build and validate a ScenarioConfiguration, and auto-fix resource permissions.
run-scenario
Execute a ScenarioConfiguration and stream ScenarioRun status with per-action breakdown until terminal state.
chaos-study
Guided help for running a Chaos Studio study against an Azure workspace scope: frame a steady-state question with you, discover live which actions Chaos Studio offers for that region, freeze a plan, run a validated scenario configuration only with your explicit consent, collect the before/during/after signals you chose, and write a self-contained HTML report for your review. Start here for questions like 'what happens to my service when X?' or 'is my service resilient to X?'.
chaos-study-scope
Frame a Chaos study before anything runs: resolve or create a Chaos Studio V2 workspace, read the resources the service discovered inside its scopes, discover live which actions and scenarios are available for that region, express a falsifiable steady-state predicate, verify the action fits what is in scope, then freeze and hash the study plan.
chaos-study-run
Execute a frozen Chaos study plan against Azure using Chaos Studio V2: verify plan integrity, create and validate a scenario configuration, require an explicit typed consent phrase, collect baseline evidence, execute the scenario run, collect during and post-recovery evidence, and always clean up the configuration. Dry-run by default.