You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/essentials/diagnostics-settings-policies-deployifnotexists.md
+45-7Lines changed: 45 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,51 @@ az policy remediation create -g rg-001 -n remediation-001 --policy-assignment p
98
98
For more information on policy assignment using CLI, see [Azure CLI reference - az policy assignment](https://learn.microsoft.com/cli/azure/policy/assignment?view=azure-cli-latest#az-policy-assignment-create)
99
99
### [PowerShell](#tab/Powershell)
100
100
101
-
Get from dev
101
+
To apply a policy using the PowerShell, use the following commands:
102
+
103
+
1. Set up your environment.
104
+
Select your subscription and set your resource group
105
+
```azurepowershell
106
+
Select-AzSubscription <subscriptionID>
107
+
$rg = Get-AzResourceGroup -Name <resource groups name>
108
+
```
109
+
110
+
1. Get the policy defintiion and configure the parameters for the policy. In the example below we assign the policy to send keyVault logs to a Log Analytics workspace
111
+
```azurepowershell
112
+
$definition = Get-AzPolicyDefinition |Where-Object Name -eq 6b359d8f-f88d-4052-aa7c-32015963ecc1
0 commit comments