1 hour 5 minutes
In the last couple of videos, we saw how we can create policy assignments in Azure.
We can use azure portal. We can use azure CLI. We can assign policies or policy initiatives.
Now let's take a look at how we can track our compliance and how we can exclude certain resource is from the policy.
Once again, I am in Azure Portal and I can click on the policy service there.
I'll get my dashboard
here. I can see all the policies that are applied or assigned to my subscription.
I have the preview CS initiative that we applied in one of the previous videos.
I have the audit resource location matching the resource group location which we applied using the CLI.
I also have the require owner attack
for the resource is that we created using azure portal
on the dashboard.
You can see what the level of compliance is against these policies. For all the resource is within the scope.
Let's take, for example, the require owner tag.
We see that this is 100% compliance
and all resource is in this resource group are compliant.
We only have a single resource there, which is the storage account.
This storage account has the proper owner attack.
That's why everything is compliant.
However, let's go back and take a look at the audit resource location.
As you remember,
in our video, we created a storage account which has a different location than the resource group.
That's why there's policy is reported as non compliant, and there's one resource that is not compliant.
Let's click on this policy, and when you go inside,
you can see every resource that is not compliant.
In this particular case, our storage account is not compliant because it was created in East us too.
And the policy requires that this resource is created where the resource group is created.
In our particular case,
that was West. Us too. Yeah,
let's look at the C s initiative.
We have 167 out of 181 policies
that we are compliant with,
but 14 are not.
If I click on the initiative, I will see all the policies that my re sources are not compliant with.
I can go and check each one of those.
As you can see, there are quite a few that we need to go through.
One thing I can do is I can go and edit the assignment.
I have a resource group where I put a virtual machine that I will use in the next videos.
I would like to exclude this resource group from this initiative.
I could go in the exclusion section, click on the browser,
and I can optionally exclude my resource group.
That will be Custom Policy Demo Resource Group from the policy
or the initiative.
I can click next
and next and nothing else changes
and I can save this initiative.
Once this initiative is stayed,
it'll take a while until this policy or initiative gets evaluate.
I'll see the updated compliance report
while we're waiting for the initiative to be reevaluated. Let's take a look at the re sources that are not compliant and specifically the resource is in the resource group that we excluded.
This is the policy demo VM.
This is just the resource group that has just a single VM.
If you click on it, you will see that we have nine noncompliant policies for that VM.
We have things like system updates should be installed.
Vulnerabilities and security configurations should be remediated and so on and so on.
Once the initiative gets re evaluated because we excluded this resource group from the initiative,
we will see that we will have nine less noncompliant policies in our report.
Let's wait for that to happen.
After some time,
the initiative got reevaluated. And as you can see now, we don't have the policy. VM that is part of the excluded resource group anymore. Available in the non compliant resource is
once we exclude some resource is or scope from the evaluation. We don't see this in the reports anymore.
In this video, we saw how we can check the policy compliance and how we can exempt Resource is from the policy evaluation.