Task 01 - Delete Azure resources created during the exercises

Introduction

As part of this training, you created multiple Azure resources (e.g., Resource Group, App Service Plan, App Service, Container Registry, Application Insights, Log Analytics, Microsoft Foundry items). To avoid incurring unnecessary costs, you must remove them now that you’ve completed the exercises.

Description

This task outlines the steps to clean up the Azure resources you created during this lab.

It is preferable to use automated teardown with the Azure Developer CLI to ensure parity with infrastructure definitions. You will use the command azd down as the PRIMARY method to delete all provisioned resources and purge the resource group.

Manual deletion should be treated as an exception path. Only if azd down fails or was not used to provision resources, you can fall back to manually deleting the resource group via Azure CLI or Portal.

Success Criteria

  • All provisioned resources for this training lab have been deleted using azd down --purge --force.
  • Or, after verifying azd down was unsuccessful, as a fallback, the resource group associated created with this training lab has been deleted manually.
  • You have, at the end of this exercise, verified no lab resources remain.

Learning Resources

Key Tasks

01: Preferred Method – Use azd down

Use the azd down command to clean up all resources if the environment was provisioned using Azure Developer CLI.

WARNING Purging is irreversible. Ensure you are targeting the correct subscription and environment.

Expand this section for detailed steps
  1. Open the Terminal window in Visual Studio Code and make sure you are in the root of the repository.

  2. To ensure you are working in the correct subscription before executing the azd down command, type az account show to view the current context for your Azure Developer CLI connection. The output will look similar to this:

     {
       "environmentName": "AzureCloud",
       "homeTenantId": "<guid>",
       "id": "<guid>",
       "isDefault": true,
       "managedByTenants": [],
       "name": "<name-of-your-subscription>",
       "state": "Enabled",
       "tenantDefaultDomain": "<tenant-domain>",
       "tenantDisplayName": "<tenant-name>",
       "tenantId": "<guid>",
       "user": {
         "name": "<your-email>",
         "type": "user"
       }
     }
    
  3. Run the following command to delete all resources:

     azd down --purge --force
    
  4. Review the key flags:
    • --purge permanently deletes the resource group.
    • --force skips interactive confirmation.
  5. Verify what this removes:
    • All resources defined in your Bicep templates (App Service, ACR, App Insights, Log Analytics, etc.)
    • The resource group (with --purge)
  6. If this completes successfully, no manual action is required.
Expand this section for troubleshooting steps

Try following these steps if azd down fails:

  1. From Terminal, verify you are in the correct folder containing the .azure environment files.

  2. Run azd env list to confirm the environment name.

  3. Ensure your Azure CLI session is authenticated: az account show.

  4. Retry with increased verbosity: azd down --purge --force --debug.

  5. If partial deletion occurred, manually delete remaining resources or the resource group (Fallback above).

02: Fallback – Manual Resource Group Deletion

Manually delete the resource group if the environment was not provisioned with azd or if azd down failed after troubleshooting.

Expand this section for detailed steps

Perform the steps in this task ONLY if:

  • The environment was not provisioned with azd, OR
  • azd down failed after troubleshooting.

Using Azure CLI (fallback)

  1. From the Terminal window in Visual Studio Code, run the following command:

     az group delete --name <your-resource-group-name> --yes --no-wait
    
  2. Replace <your-resource-group-name> with the name of the resource group you created for this training.

Using Azure Portal (fallback)

  1. Open the Azure portal
  2. Navigate to Resource groups.
  3. Select the training resource group.
  4. Click Delete resource group.
  5. Type the name to confirm and select Delete.

03: Verification

Verify that no lab resources remain after cleanup.

Expand this section for detailed steps
  1. Run the following verification commands:

     # List resource groups in the current subscription
     az group list --output table
    
     # List resources with the name "zava" or "<your-env-name>" according to the naming used during the exercises
     az resource list --query "[?contains(name, 'zava') || contains(name, '<your-env-name>')]" --output table
    
     # List web apps
     az webapp list --output table
    
     # List container registries
     az acr list --output table
    
  2. Verify that the resource group and associated resources used for this lab no longer appear if the cleanup is complete.

Summary

You’ve completed this task. All provisioned resources for this training lab have been deleted using azd down --purge --force, or the resource group has been deleted manually as a fallback.