Hello Dave, Welcome to MS Q&A, I think would be difficulty from single command but you can try below script
# Connect to Azure using PowerShell
Connect-AzAccount
# Get a list of subscriptions
$subscriptions = Get-AzSubscription
# Loop through each subscription and remove MS Cloud Benchmark Definition
foreach ($subscription in $subscriptions) {
# Set the current subscription context
Set-AzContext -SubscriptionId $subscription.Id
# Remove the MS Cloud Benchmark Definition
# Replace 'YourPolicyDefinitionName' with the actual name of the policy definition
$policyDefinition = Get-AzPolicyDefinition | Where-Object { $_.Properties.DisplayName -eq 'YourPolicyDefinitionName' }
if ($policyDefinition) {
Remove-AzPolicyAssignment -Name $policyDefinition.Name -Scope "/subscriptions/$($subscription.Id)"
Write-Output "Removed MS Cloud Benchmark Definition from subscription: $($subscription.Name)"
} else {
Write-Output "MS Cloud Benchmark Definition not found in subscription: $($subscription.Name)"
}
}
This script connects to Azure, retrieves a list of subscriptions, and loops through each subscription to remove the MS Cloud Benchmark Definition. Replace 'YourPolicyDefinitionName' with the actual name of the policy definition you want to remove.
Kindly accept answer if it helps
Please let us know if any further questions
Thanks
Deepanshu