Skip to content

Commit

Permalink
adding pol test 2 button
Browse files Browse the repository at this point in the history
  • Loading branch information
kramit committed Mar 29, 2020
1 parent 70cf9b1 commit 0ca286e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 48 deletions.
4 changes: 0 additions & 4 deletions templates/policytest/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Deployment of 2 resource groups



<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fkramit%2FAZ103-Notes%2Fmaster%2Ftemplates%2Fpolicytest%2Fazuredeploy.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.png"/>
</a>
82 changes: 43 additions & 39 deletions templates/policytest/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,57 @@
"parameters": {
"rgName": {
"type": "string"
},
"rgLocation": {
"type": "string",
"defaultValue": "eastus"
}

},
"variables": {},
"variables": {
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2018-05-01",
"name": "[parameters('rgName')]",
"location": "[parameters('rgLocation')]",
"properties": {}
},
{
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2018-05-01",
"name": "locationpolicy",
"properties": {
"policyType": "Custom",
"parameters": {},
"policyRule": {
"if": {
"field": "location",
"equals": "northeurope"
},
"then": {
"effect": "deny"
}
"name": "locationpolicy",
"properties": {
"policyType": "Custom",
"parameters": {
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"not": {
"field": "Microsoft.Compute/virtualMachines/sku.name",
"in": [
"Standard_DS3_v2"
]
}
}
]
},
"then": {
"effect": "Deny"
}
}
},
{
"type": "Microsoft.Authorization/policyAssignments",
"apiVersion": "2018-05-01",
"name": "location-lock",
"dependsOn": [
"locationpolicy"
],
"properties": {
"scope": "[subscription().id]",
"policyDefinitionId": "[resourceId('Microsoft.Authorization/policyDefinitions', 'locationpolicy')]"
}
}

},
{
"type": "Microsoft.Authorization/policyAssignments",
"apiVersion": "2018-05-01",
"name": "location-lock",
"dependsOn": [
"locationpolicy"
],
"properties": {
"scope": "[concat('/subscription/', subscription().Id, '/resourceGroups/', resourceGroup().name)]",
"policyDefinitionId": "[resourceId('Microsoft.Authorization/policyDefinitions', 'locationpolicy')]"
}
}

],
"outputs": {}
"outputs": {
}
}
3 changes: 0 additions & 3 deletions templates/policytest/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"parameters": {
"rgName": {
"value": "az104-06-rg01"
},
"rgLocation": {
"value": "eastus"
}
}
}
2 changes: 0 additions & 2 deletions templates/policytest/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/bash
echo "Deploying template for module 6"
echo "Deploying 2 resource groups"
az deployment create --name "null" --location "eastus" --template-file azuredeploy.json --parameters azuredeploy.parameters.json
4 changes: 4 additions & 0 deletions templates/policytestvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fkramit%2FAZ103-Notes%2Fmaster%2Ftemplates%2Fpolicytestvm%2Faz104-04-vms-template.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.png"/>
</a>

0 comments on commit 0ca286e

Please sign in to comment.