Bearbeiten

Freigeben über


Get-AzPolicySetDefinition

Gets policy set definitions.

Syntax

Get-AzPolicySetDefinition
   [-Name <String>]
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   [-Name <String>]
   -ManagementGroupName <String>
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   [-Name <String>]
   -SubscriptionId <String>
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   [-Name <String>]
   [-Id <String>]
   [-BackwardCompatible]
   -Version <String>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   [-Name <String>]
   [-Id <String>]
   [-ListVersion]
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   -Id <String>
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzPolicySetDefinition
   [-SubscriptionId <String>]
   [-ManagementGroupName <String>]
   [-Builtin]
   [-BackwardCompatible]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Builtin

Causes cmdlet to return only built-in policy definitions.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Custom

Causes cmdlet to return only custom policy definitions.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

The full Id of the policy definition to get.

Type:String
Aliases:ResourceId
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ListVersion

Causes cmdlet to return only custom policy definitions.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ManagementGroupName

The name of the management group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the policy definition to get.

Type:String
Aliases:PolicySetDefinitionName
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Version

The policy definition version in #.#.# format.

Type:String
Aliases:PolicySetDefinitionVersion
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

SwitchParameter

String

Outputs

IPolicySetDefinition