
Skill
azsdk-common-live-and-recorded-tests
deploy resources and run Azure SDK tests
Description
Deploy test resources and run Azure SDK tests in live, record, or playback mode. WHEN: "run live tests", "run recorded tests", "deploy test resources", "record tests", "run tests in record mode", "clean up test resources", "run tests against live resources". DO NOT USE FOR: writing new tests, authoring Bicep templates, playback-only test runs without resource deployment. INVOKES: azure-sdk-mcp:azsdk_package_run_tests.
SKILL.md
Live and Recorded Tests
MCP Tools
| Tool | Purpose |
|---|---|
azure-sdk-mcp:azsdk_package_run_tests | Run tests in playback, record, or live mode |
IMPORTANT: ALWAYS use the
azure-sdk-mcp:azsdk_package_run_testsMCP tool to run tests. NEVER run test commands directly in the terminal (e.g.,pytest,dotnet test,mvn test,npm test,go test). The MCP tool handles test mode configuration, environment setup, and automatic asset pushing in record mode.
Prerequisites
- azure-sdk-mcp server must be running
- Azure PowerShell module (
Az) must be installed. IfGet-AzContextfails with a command-not-found error, instruct the user to install it withInstall-Module Az -Scope CurrentUser -Force. - For live/record modes: an Azure subscription with permissions to create resources
- Use the Azure SDK Test Resources - TME (id: 4d042dc6-fe17-4698-a23f-ec6a8d1e98f4) subscription if not already authenticated and no other subscription is specified.
Steps
- Identify service directory — Determine the service directory for the package under test (e.g.,
keyvault,storage). This is required by the test resource deployment script. - Check for existing deployment — Look for a
.envfile at either the service directory level (next totest-resources.bicep, e.g.sdk/storage/.env) or at the package level (e.g.sdk/storage/storage-blob/.env). If one exists, inform the user that a previous deployment appears to be available and ask whether to reuse the existing deployment or redeploy test resources. If reusing, skip to step 7. - Verify Azure context — Run
Get-AzContextto check for an active Azure PowerShell session. If the command fails because the Az module is not installed, instruct the user to runInstall-Module Az -Scope CurrentUser -Forcefirst. If no context exists, guide the user throughConnect-AzAccount -TenantId [TME tenant ID]. IfConnect-AzAccountappears to hang and no browser window opens for authentication, tell the user to copy and paste the command into a new PowerShell window. Confirm the correct subscription is selected. - Confirm deployment — Even if no existing
.envfile is found, confirm with the user before proceeding to deploy test resources. Deployment creates Azure resources that may incur costs. - Deploy test resources — Run
eng/common/TestResources/New-TestResources.ps1with the service directory, tenant ID, subscription ID, and any user-provided parameters. Use the TME tenant ID and subscription ID if one has not already been provided. See deployment parameters for details. The script outputs environment variables needed for live/record test runs. - Save environment — Capture the environment variables output by the deployment script. If the script writes a
.envfile, note its path. Otherwise, collect the environment variables from the script output. In azure-sdk-for-net, if the script outputs a file liketest-resources.bicep.envinstead of a.envfile, move on to step 7 and call the MCP tool WITHOUT passing an env filepath. The test framework will automatically find and handle this special file type. - Run tests — Call the
azure-sdk-mcp:azsdk_package_run_testsMCP tool (do NOT run test commands directly in the terminal). Provide the appropriate test mode (record,live, orplayback) and the path to the.envfile containing test environment variables. When tests run in record mode and all tests pass, the tool automatically pushes recorded test assets to the assets repo. - Clean up — Ask the user whether to clean up test resources. If yes, run
eng/common/TestResources/Remove-TestResources.ps1. If no, inform the user that resources remain deployed for subsequent test runs. See cleanup details.
Examples
- "Deploy test resources and run live tests for this package"
- "Run the tests in record mode using the live test deployment specified in .env"
- "Clean up my test resources for keyvault"
- "Run tests in record mode against my existing deployment"
- "Set up live test resources for storage and run all tests"
Troubleshooting
- No Azure context: Run
Connect-AzAccountand select the target subscription withSet-AzContext -SubscriptionId <id>. If the browser window for authentication fails to open and the command appears to hang, tell the user to copy and paste theConnect-AzAccountcommand into a new PowerShell window and run it there instead. - Az module not installed: If
Get-AzContextfails with a command-not-found error, the Azure PowerShell module is not installed. Instruct the user to runInstall-Module Az -Scope CurrentUser -Forceand then retry. - Deployment fails with auth error: Verify that the signed-in account has Contributor or Owner role on the target subscription. Check
Get-AzContextoutput. - Deployment fails with resource conflict: A previous deployment may still exist. Try running
Remove-TestResources.ps1first, or use a differentBaseName. - Tests fail in record mode: Check that all environment variables from the deployment are being passed correctly. Verify the
.envfile path is correct. - Assets push fails after recording: Ensure the assets repo is configured and accessible. Check git authentication.
More skills from the azure-sdk-tools repository
View all 10 skillsapiview-feedback-resolution
resolve APIView feedback on Azure SDKs
Jul 12API DevelopmentAzureCode ReviewDocumentationazsdk-common-prepare-release-plan
manage Azure SDK release plan work items
Jul 12AzureGitHubProject ManagementSDKazsdk-common-sdk-release
release Azure SDK packages
Jul 12AzureCI/CDDeploymentSDKazure-typespec-author
author and modify Azure TypeSpec API specifications
Jul 12API DevelopmentAzureOpenAPITechnical Writinggenerate-sdk-locally
generate and test Azure SDKs locally
Jul 12AzureCI/CDSDKTestingmarkdown-token-optimizer
optimize markdown files for token efficiency
Jul 12LLMPerformanceTechnical Writing
More from Azure (Microsoft)
View publisherazure-arg-external-evaluation-policy-author
author and test Azure Resource Graph policies
azure-policy
Jul 12AzureComplianceGovernancePolicyazure-blueprints-migration
migrate Azure Blueprints to Template Specs
azure-blueprints
Jul 12AzureDeploymentInfrastructure as CodeMigrationpipeline-troubleshooting
troubleshoot Azure SDK CI pipelines
azure-sdk-tools
Jul 12AzureCI/CDDebuggingSDKsensei
improve skill frontmatter compliance
azure-sdk-tools
Jul 12AzureComplianceProcess OptimizationTechnical Writingskill-authoring
author agent skills for agentskills.io
azure-sdk-tools
Jul 12DocumentationPlugin DevelopmentTechnical Writing