Azure Policy is a Microsoft service in Azure used for creating and managing policies , assignments and definition and it is used to force some roles on some resources in case of some actions.
- Policy definition: is the conditions of the policy
- Policy assignment: in the part we can define which resource or services you need to apply this policy on it , add in your note that the policy assignment by default inherited so for example if you applied Policy on Subscription it will be inherited on all of the resource under this subscription
- Policy parameters: it will give you the availability to custom your policy
- Azure initiative Policy: it the like Azure policy but we can use when you need to do group of policy in one step and it is containing the 3 parts (initiative definition, initiative assignment, initiative parameters) “Policy Combo
Today we will create Azure policy to enforce any new resource for using tag let’s go to see how we can create this policy using PowerShell Command.
IF you need to check all of my azure posts ➡ Latest Microsoft Azure Articles and Posts
- Create Resource Group “IF you need it is not mandatory”
- Save the Resource Group in PowerShell variable ($resource)
- Call the Resource Group ID
- Get the Azure Policy definition of required to assign tag for any new resource will be created
- Save the Azure policy information into PowerShell variable ($Policy)
- Create Azure Policy