< Back

Get-AzureRmPolicyAssignment

Tue Jan 29, 2019 10:05 pm

NAME Get-AzureRmPolicyAssignment



SYNOPSIS

Gets policy assignments.





SYNTAX

Get-AzureRmPolicyAssignment [-ApiVersion <String>] [-DefaultProfile <IAzureContextContainer>] -Id <String> [-InformationAction <ActionPreference>]

[-InformationVariable <String>] [-PolicyDefinitionId <String>] [-Pre] [<CommonParameters>]



Get-AzureRmPolicyAssignment [-ApiVersion <String>] [-DefaultProfile <IAzureContextContainer>] [-InformationAction <ActionPreference>]

[-InformationVariable <String>] [-Name <String>] [-PolicyDefinitionId <String>] [-Pre] -Scope <String> [<CommonParameters>]





DESCRIPTION

The Get-AzureRmPolicyAssignment cmdlet gets all policy assignments or particular assignments. Identify a policy assignment to get by name and

scope or by ID.





PARAMETERS

-ApiVersion <String>

Specifies the version of the resource provider API to use. If you do not specify a version, this cmdlet uses the latest available version.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Id <String>

Specifies the fully qualified resource ID for the policy assignment that this cmdlet gets.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-InformationAction <ActionPreference>

Specifies how this cmdlet responds to an information event.



The acceptable values for this parameter are:



- Continue



- Ignore



- Inquire



- SilentlyContinue



- Stop



- Suspend



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>

Specifies an information variable.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the name of the policy assignment that this cmdlet gets.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-PolicyDefinitionId <String>

Specifies the ID of the policy definition of the policy assignments that this cmdlet gets.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Pre [<SwitchParameter>]

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Scope <String>

Specifies the scope at which the policy is applied for the assignment that this cmdlet gets.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

System.Management.Automation.PSObject







NOTES









Example 1: Get all policy assignments



PS C:\\>Get-AzureRmPolicyAssignment



This command gets all the policy assignments.





Example 2: Get a specific policy assignment



PS C:\\>$ResourceGroup = Get-AzureRmResourceGroup -Name "ResourceGroup11"

PS C:\\> Get-AzureRmPolicyAssignment -Name "PolicyAssignment07" -Scope $ResourceGroup.ResourceId



The first command gets a resource group named ResourceGroup11 by using the Get-AzureRMResourceGroup cmdlet. The command stores that object in the

$ResourceGroup variable.



The second command get the policy assignment named PolicyAssignment07 for the scope that the ResourceId property of $ResourceGroup identifies.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... assignment

New-AzureRmPolicyAssignment

Remove-AzureRmPolicyAssignment

Set-AzureRmPolicyAssignment