Skip to content

Commit

Permalink
again 4
Browse files Browse the repository at this point in the history
  • Loading branch information
kramit committed Mar 29, 2020
1 parent f36131d commit 6e8bbd0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
31 changes: 30 additions & 1 deletion templates/policyapplytest/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
New-AzResourceGroupDeployment -ResourceGroupName "testing" -TemplateFile azuredeploy.json -TemplateParameterFile azuredeploy.parameters.json
New-AzResourceGroupDeployment -ResourceGroupName "testing" -TemplateFile azuredeploy.json -TemplateParameterFile azuredeploy.parameters.json

------------------------------

To deploy a custom azure policy to a resource group there needs to be 2 deployments, as the creation of policy is a subscription level ARM deployment and the application of the policy to a resource group is a resource group level deployment.

# testing is as follows

## git pull the repo into cloud shell

1. from cloud shell in powershell mode run

git pull https://github.com/kramit/AZ103-Notes.git

2. cd into AZ103-Notes/templates/



## create and apply the template

1. Manually create a resource group called "testing" this is because the resource group name is hard coded into the policyapplytest azuredeploy.json parameters at the top of the file

2. run the following from the policydeploytest dir using cloud shell this will create the custom template

New-AzDeployment -Location "east us" -templatefile ./azuredeploy.json -TemplateParameterFile ./azuredeploy.parameters.json

3. run the following from policyapplytest dir using cloud shell this will apple the custom template to the rg of "testing"

New-AzResourceGroupDeployment -ResourceGroupName "testing" -TemplateFile azuredeploy.json -TemplateParameterFile azuredeploy.parameters.json

28 changes: 28 additions & 0 deletions templates/policydeploytest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,31 @@ Deploy custom azure policy

New-AzDeployment -Location "east us" -templatefile ./azuredeploy.json -TemplateParameterFile ./azuredeploy.parameters.json

------------------------------

To deploy a custom azure policy to a resource group there needs to be 2 deployments, as the creation of policy is a subscription level ARM deployment and the application of the policy to a resource group is a resource group level deployment.

# testing is as follows

## git pull the repo into cloud shell

1. from cloud shell in powershell mode run

git pull https://github.com/kramit/AZ103-Notes.git

2. cd into AZ103-Notes/templates/



## create and apply the template

1. Manually create a resource group called "testing" this is because the resource group name is hard coded into the policyapplytest azuredeploy.json parameters at the top of the file

2. run the following from the policydeploytest dir using cloud shell this will create the custom template

New-AzDeployment -Location "east us" -templatefile ./azuredeploy.json -TemplateParameterFile ./azuredeploy.parameters.json

3. run the following from policyapplytest dir using cloud shell this will apple the custom template to the rg of "testing"

New-AzResourceGroupDeployment -ResourceGroupName "testing" -TemplateFile azuredeploy.json -TemplateParameterFile azuredeploy.parameters.json

0 comments on commit 6e8bbd0

Please sign in to comment.