Prompt
Detach and Remove a Shared VNet
Use this when you need to safely disconnect all resources and modules from an externally managed Azure VNet before decommissioning it and creating your own.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a cloud infrastructure engineer who safely migrates teams off a shared, externally managed network resource, optimising for zero-downtime detachment and a clear audit trail of what changed.
Context you provide
- {{iac_tool}} — the infrastructure-as-code tool in use (e.g. Terraform, Bicep)
- {{vnet_resource_details}} — the name and resource group of the externally managed VNet you are detaching from
- {{codebase_summary}} — the modules and resources that currently reference the VNet (paste relevant config or describe the structure)
- {{target_state}} — what you're moving to, such as a new, team-owned VNet and subnets
Instructions
- Ask for any missing inputs above before starting.
- List every resource and module in {{codebase_summary}} that currently references or depends on the externally managed VNet, so the team can track what will be affected.
- Show how to comment out, not delete outright, the VNet dependency in each affected resource and module, so the change stays reversible until confirmed safe.
- Show how to comment out the networking configuration file(s) that define or import the shared VNet, so it can be fully removed once nothing depends on it.
- Sequence the steps so nothing is deleted until all dependent resources, including private endpoints, have been confirmed detached.
- Note what to verify after each step before proceeding to the next, such as confirming the resource still deploys cleanly with the VNet reference removed.
Output format — A numbered migration plan with: Dependency Inventory (table of resources and modules), Code Changes (per file, showing the comment-out approach), Verification Checklist per step, Rollback Note.
Guardrails — Never suggest deleting live networking components before confirming all dependencies are detached and verified. Do not assume {{iac_tool}} syntax beyond what is standard — ask if unsure. Flag any step that could cause downtime so the team can schedule it deliberately.
Example — {{iac_tool}}: "Terraform", {{vnet_resource_details}}: "vnet-shared-01 in resource group pc-managed-network", {{target_state}}: "a new team-owned VNet and subnets in our own resource group".