Get-AzPolicySetDefinition
Gets policy set definitions.
Syntax
Name (Default)
Get-AzPolicySetDefinition
[-Name <String>]
[-ListVersion]
[-Expand <String>]
[-Version <String>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ManagementGroupName
Get-AzPolicySetDefinition
-ManagementGroupName <String>
[-Name <String>]
[-ListVersion]
[-Expand <String>]
[-Version <String>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
SubscriptionId
Get-AzPolicySetDefinition
-SubscriptionId <String>
[-Name <String>]
[-ListVersion]
[-Expand <String>]
[-Version <String>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Builtin
Get-AzPolicySetDefinition
[-SubscriptionId <String>]
[-ManagementGroupName <String>]
[-Builtin]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Custom
Get-AzPolicySetDefinition
[-SubscriptionId <String>]
[-ManagementGroupName <String>]
[-Custom]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Id
Get-AzPolicySetDefinition
-Id <String>
[-ListVersion]
[-Expand <String>]
[-Version <String>]
[-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: Get policy set definition version by id
Get-AzPolicySetDefinition -Id '/providers/Microsoft.Authorization/policySetDefinitions/1bb84455-9e6e-434c-8db6-fa6d03a67e87' -Version "1.1.1"
This command gets version 1.1.1 of policy definition with ID /providers/Microsoft.Authorization/policySetDefinitions/1bb84455-9e6e-434c-8db6-fa6d03a67e87.
Example 7: Get all policy set definition versions of a policy set definition by name
Get-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -ListVersion
This command gets all policy set definition versions of the policy set definition named VMPolicySetDefinition from the current default subscription.
Parameters
-Builtin
Causes cmdlet to return only built-in policy set 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 set 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
-Expand
Comma-separated list of additional properties to be included in the response.
Supported values are 'LatestDefinitionVersion, EffectiveDefinitionVersion'.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
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
Id
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Id
The full Id of the policy set definition to get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ResourceId
Parameter sets
Id
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ListVersion
Causes cmdlet to return only custom policy set definition versions.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
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
Id
Position: Named
Mandatory: False
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 set 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
-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 set definition version in #.#.# format.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: PolicySetDefinitionVersion
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
Id
Position: Named
Mandatory: False
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