Destroy Site in Azure - Esri/arcgis-gitops GitHub Wiki

This walkthrough guides you through using GitHub Actions to destroy the resources created by the Getting Started in Azure walkthrough.

In particular, the walkthrough will:

  1. Create and configure a codespace workspace in the private GitHub repository
  2. Destroy the core Azure resources of the site
  3. Delete the Azure Blob Storage account of the Terraform backend
  4. Delete the private GitHub repository of the site

Duration: about 30 minutes

Prerequisites

Before you begin this walkthrough:

  • Destroy all deployments in the ArcGIS Enterprise site.

You will need the following resources and accounts:

  • GitHub.com user account
  • Service principal in a Microsoft Azure account with the Owner role

Step 1. Create and Configure a Codespace Workspace

This step will create a codespace workspace in the private GitHub repository and configure it to use Azure CLI to destroy the resources created by Getting Started in Azure walkthrough.

1.1 Log in to the GitHub.com account

Open the GitHub.com URL in a web browser and log in to your GitHub.com account.

Browse to the private repository "gitops-demo" created in Getting Started in Azure walkthrough.

1.2 Create a codespace workspace

In the new repository, click the green <> Code button, switch to the "Codespaces" tab, and click the Create codespace on main button. The codespace will be created and opened in a new browser tab.

Instead of creating a codespace, you can also reuse the codespace created in Getting Started in Azure walkthrough if it is still available. In this case, you can skip this step and go to step 2.

1.3 Install Azure CLI in the codespace

In the codespace, click on the "Terminal" tab in the bottom panel, and run the following commands:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

1.4 Log in to Azure

Run the following commands, replacing <client id>, <client secret>, and <tenant id> with the service principal's credentials:

az login --service-principal --username <client id> --password <client secret> --tenant <tenant id>

Step 2. Destroy the Core Azure Resources of the Site

This step will destroy the Azure resources of the site created by Getting Started in Azure walkthrough.

2.1 Run site-k8s-cluster-azure-destroy workflow

Run GitHub Actions workflow site-k8s-cluster-azure-destroy to destroy the Azure Kubernetes Service (AKS) cluster.

Click on "Actions" tab in the repository, refresh the web page, select "site-k8s-cluster-azure-destroy" workflow on the left sidebar, click "Run workflow" on the right, and click "Run workflow" button.

This step is not required if the AKS cluster was not created.

2.2 Run site-ingress-azure-destroy workflow

Run GitHub Actions workflow "site-ingress-azure-destroy" to destroy the Azure resources created by the "site-ingress-azure" workflow.

This step is not required if the ingress resources were not created.

2.3 Run site-automation-chef-azure-destroy workflow

Run GitHub Actions workflow "site-automation-chef-azure-destroy" to destroy the Azure resources created by "site-automation-chef-azure" workflow.

Click on "Actions" tab in the repository, refresh the web page, select "site-automation-chef-azure-destroy" workflow on the left sidebar, click "Run workflow" on the right, and click "Run workflow" button.

2.4 Run site-core-azure-destroy workflow

Run GitHub Actions workflow "site-core-azure-destroy" to destroy the Azure resources created by "site-core-azure" workflow.

Click on "Actions" tab in the repository, refresh the web page, select "site-core-azure-destroy" workflow on the left sidebar, click "Run workflow" on the right, and click "Run workflow" button.

2.5 Delete the storage account of the Terraform backend

Run the following command replacing <storage account name> with the name of the storage account created in Getting Started in Azure walkthrough to delete the storage account used by the Terraform backend.

az storage account delete --name <storage account name> --resource-group arcgis-gitops

Step 3. Delete the site's private GitHub repository

This step deletes the private GitHub repository "gitops-demo" in your GitHub account created in Getting Started in Azure walkthrough.

3.1 Delete the private GitHub repository

In the private repository "Settings" tab, click on the "Delete this repository" button, and confirm the deletion.

Conclusion

This walkthrough has guided you through using GitHub Actions to destroy the resources for an ArcGIS Enterprise site created by Getting Started in Azure walkthrough.

⚠️ **GitHub.com Fallback** ⚠️