I'm trying to create and delete an Azure Resource Group from the ARM JSON Template. I manually tried to create a Resource Group and saved the Template from the Azure Portal.
Here is the Json version of the ARM template for the Resource Group:
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {
"rgName": {
"type": "string"
},
"rgLocation": {
"type": "string"
},
"tags": {
"type": "object",
"defaultValue": {}
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2018-05-01",
"location": "[parameters('rgLocation')]",
"name": "[parameters('rgName')]",
"properties": {},
"tags": "[parameters('tags')]"
}
],
"outputs": {}
}
I want is to create a Resource Group and later destroy the Resource Group from a GitHub Workflow. I have already some Workflow script to deploy resources in a Resource Group. An example is below:
- name: Deploy Function App Resources
uses: azure/arm-deploy@v1
with:
scope: resourcegroup
subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: ${{ env.AZURE_RESOURCE_GROUP }}
parameters: ./parameters.json
template: ./azure-deploy-function-api.json
What I want is to create the Resource Group before deploying the resources to it. Later I want destroy the whole Resource Group and the resources underneath it.