Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Start-AzPolicyComplianceScan
- Module:
- Az.PolicyInsights Module
Triggers a policy compliance evaluation for all resources in a subscription or resource group.
Syntax
SubscriptionScope (Default)
Start-AzPolicyComplianceScan
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ResourceGroupScope
Start-AzPolicyComplianceScan
[-ResourceGroupName <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Start-AzPolicyComplianceScan cmdlet starts a policy compliance evaluation for a subscription or resource group.
All resources within that scope will have their compliance state evaluated against all assigned policies.
Examples
Example 1: Start a compliance scan at subscription scope
Start-AzPolicyComplianceScan
This command starts a policy compliance evaluation for the active subscription.
Example 2: Start a compliance scan at resource group scope
Start-AzPolicyComplianceScan -ResourceGroupName "myRG"
This command starts a policy compliance evaluation for the "myRG" resource group in the active subscription.
Example 3: Start a compliance scan and wait for it to complete in the background
$job = Start-AzPolicyComplianceScan -AsJob
$job | Wait-Job
This command starts a policy compliance evaluation for the active subscription as a job, then it waits for the scan to complete.
Parameters
-AsJob
Run the command as a job.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Parameter properties
| Type: | PSObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzureRMContext, AzureCredential |
Parameter sets
-NoWait
Run the command asynchronously
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PassThru
Returns true when the command succeeds
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Resource group name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SubscriptionId
The ID of the target subscription. Uses current subscription if one isn't provided.
Parameter properties
| Type: | String |
| Default value: | (Get-AzContext).Subscription.Id |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Outputs
Boolean
Azure PowerShell
Feedback
Was this page helpful?
