Azure / Azure/azure-sdk-tools

[Test Resources] Cleanup Resources on Failure

Open
#1,984 0 comments 0 reactions 0 assignees View on GitHub
Client EngSys
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
144

Description

# Summary

Executing the `New-TestResources.ps1` script creates a resource group and, optionally, a Test Application service principal. In cases where the script fails to complete, any created resources are left orphaned in an unknown state. Most often, the orphaned resources can't be assumed as safe to use for running live tests and should be cleaned up.

# Scope of Work

- Refactor `New-TestResources.ps1 to track the resources it creates as it executes and to remove those resources when execution does not successfully complete.

- Ensure that any hard failures are critical; scenarios that result in a valid set of resources that can be salvaged with reasonable manual intervention should be converted to warnings and not cause the script to abort.

# Success Criteria

- The changes detailed in the scope have been implemented.

- `New-TestResources.ps1` can be run successfully within the Microsoft tenant in the context of the interactive caller.

- `New-TestResources.ps1` can be run successfully within the Microsoft tenant in the context of a provisioner service principal.

- `New-TestResources.ps1` can be run successfully using a non-Microsoft tenant in the context of the interactive caller.

- `New-TestResources.ps1` can be run successfully using a non-Microsoft tenant in the context of a provisioner service principal.

Contributor guide

Open the contributing guide

Research direction

Start by reading New-TestResources.ps1 and trace where it creates the resource group and optional Test Application service principal. Check how failures are currently handled, then verify cleanup and warning-versus-critical behavior in the four interactive and provisioner-service-principal scenarios across Microsoft and non-Microsoft tenants. Done means successful runs leave valid resources and failed runs remove resources they created.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, devops, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.