Get-AzPolicySetDefinition
Gets policy set definitions.
Syntax
Name (Default)
Get-AzPolicySetDefinition
[-Name <String>]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ManagementGroupName
Get-AzPolicySetDefinition
-ManagementGroupName <String>
[-Name <String>]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
SubscriptionId
Get-AzPolicySetDefinition
-SubscriptionId <String>
[-Name <String>]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Version
Get-AzPolicySetDefinition
-Version <String>
[-Name <String>]
[-Id <String>]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ListVersion
Get-AzPolicySetDefinition
[-Name <String>]
[-Id <String>]
[-ListVersion]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Id
Get-AzPolicySetDefinition
-Id <String>
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Builtin
Get-AzPolicySetDefinition
[-SubscriptionId <String>]
[-ManagementGroupName <String>]
[-Builtin]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Custom
Get-AzPolicySetDefinition
[-SubscriptionId <String>]
[-ManagementGroupName <String>]
[-Custom]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Description
The Get-AzPolicySetDefinition cmdlet gets a collection of policy set definitions or a specific policy set definition identified by name or ID.
Examples
Example 1: Get all policy set definitions
Get-AzPolicySetDefinition
This command gets all the policy set definitions.
Example 2: Get policy set definition from current subscription by name
Get-AzPolicySetDefinition -Name 'VMPolicySetDefinition'
This command gets the policy set definition named VMPolicySetDefinition from the current default subscription.
Example 3: Get policy set definition from subscription by name
Get-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -subscriptionId '3bf44b72-c631-427a-b8c8-53e2595398ca'
This command gets the policy definition named VMPolicySetDefinition from the subscription with ID 3bf44b72-c631-427a-b8c8-53e2595398ca.
Example 4: Get all custom policy set definitions from management group
Get-AzPolicySetDefinition -ManagementGroupName 'Dept42' -Custom
This command gets all custom policy set definitions from the management group named Dept42.
Example 5: Get policy set definitions from a given category
Get-AzPolicySetDefinition | Where-Object {$_.metadata.category -eq "Virtual Machine"}
This command gets all policy set definitions in category "Virtual Machine".
Example 6: [Backcompat] Get policy set definitions from a given category
Get-AzPolicySetDefinition -BackwardCompatible | Where-Object {$_.Properties.metadata.category -eq "Virtual Machine"}
This command gets all policy set definitions in category "Virtual Machine".
Parameters
-BackwardCompatible
Causes cmdlet to return artifacts using legacy format placing policy-specific properties in a property bag object.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Builtin
Causes cmdlet to return only built-in policy definitions.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
Builtin
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Custom
Causes cmdlet to return only custom policy definitions.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
Custom
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Id
The full Id of the policy definition to get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ResourceId
Parameter sets
Version
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ListVersion
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ListVersion
Causes cmdlet to return only custom policy definitions.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ListVersion
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ManagementGroupName
The name of the management group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ManagementGroupName
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Name
The name of the policy definition to get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: PolicySetDefinitionName
Parameter sets
Name
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ManagementGroupName
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
SubscriptionId
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
Version
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ListVersion
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-SubscriptionId
The ID of the target subscription.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SubscriptionId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Version
The policy definition version in #.#.# format.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: PolicySetDefinitionVersion
Parameter sets
Version
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
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