https://github.com/tombuildsstuff/azurerm-dalek
Works through an Azure subscription and removes all matching resources
https://github.com/tombuildsstuff/azurerm-dalek
Last synced: over 1 year ago
JSON representation
Works through an Azure subscription and removes all matching resources
- Host: GitHub
- URL: https://github.com/tombuildsstuff/azurerm-dalek
- Owner: tombuildsstuff
- License: mit
- Created: 2018-12-11T16:29:26.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T09:30:03.000Z (about 2 years ago)
- Last Synced: 2025-02-27T05:02:17.641Z (over 1 year ago)
- Language: Go
- Size: 4.77 MB
- Stars: 5
- Watchers: 6
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure Dalek
Azure Dalek will work through your Azure Subscription and delete everything it comes across (matching a filter).
~> **NOTE / BE AWARE:** This will delete resources in your Azure Subscription which do not include the tag `DoNotDelete` - please read the source to understand before running.
The Dalek supports using both a Service Principal and your Azure CLI credentials. The following Environment Variables can be configure:
* `ARM_CLIENT_ID` - (Optional) The Client ID associated with the Service Principal used for authentication
* `ARM_CLIENT_SECRET` - (Optional) The Client Secret associated with the Service Principal used for authentication
* `ARM_ENVIRONMENT` - (Optional) The Azure Environment which the tests should be run against, e.g. `public`, `german`, `azurestackcloud`. Defaults to `public`.
* `ARM_SUBSCRIPTION_ID` - The ID of the Azure Subscription within the Tenant
* `ARM_TENANT_ID` - The ID of the Azure Tenant
* `ARM_ENDPOINT` - (Optional) The URI of a Custom Resource Manager Endpoint, intended for use with Azure Stack.
* `YES_I_REALLY_WANT_TO_DELETE_THINGS` - (Optional) Set this to `true` to actually delete resources
It's also possible to use the following command line flags:
* `prefix` - (Optional) An optional prefix for Resource Group names.
## Dependencies
* Go 1.19
## Example Usage
To delete using your Azure CLI Credentials against Azure Public:
```sh
$ go build .
$ YES_I_REALLY_WANT_TO_DELETE_THINGS="true" ./azurerm-dalek
```
To delete with a Service Principal against Azure Public:
```sh
$ export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_CLIENT_SECRET="00000000-0000-0000-0000-000000000000"
$ export ARM_ENVIRONMENT="public"
$ export ARM_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_TENANT_ID="00000000-0000-0000-0000-000000000000"
$ go build .
$ YES_I_REALLY_WANT_TO_DELETE_THINGS="true" ./azurerm-dalek
```
To delete using your Azure CLI Credentials against Azure Stack:
```sh
$ go build .
$ YES_I_REALLY_WANT_TO_DELETE_THINGS="true" ./azurerm-dalek
```
To delete with a Service Principal against Azure Stack:
```sh
$ export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_CLIENT_SECRET="00000000-0000-0000-0000-000000000000"
$ export ARM_ENVIRONMENT="public"
$ export ARM_ENDPOINT="https://management.westus.mydomain.com
$ export ARM_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_TENANT_ID="00000000-0000-0000-0000-000000000000"
$ go build .
$ YES_I_REALLY_WANT_TO_DELETE_THINGS="true" ./azurerm-dalek
```
## Licence
MIT