Skip to content

Latest commit

 

History

History
247 lines (170 loc) · 5.46 KB

Export-AzPolicyAssignmentData.md

File metadata and controls

247 lines (170 loc) · 5.46 KB
external help file Module Name online version schema
PSRule.Rules.Azure-help.xml
PSRule.Rules.Azure
2.0.0

Export-AzPolicyAssignmentData

SYNOPSIS

Export policy assignment data.

SYNTAX

Default (Default)

Export-AzPolicyAssignmentData [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Name

Export-AzPolicyAssignmentData [-Name <string>] [-Scope <string>] [-PolicyDefinitionId <string>] [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Id

Export-AzPolicyAssignmentData -Id <string> [-PolicyDefinitionId <string>] [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

IncludeDescendent

Export-AzPolicyAssignmentData -IncludeDescendent [-Scope <string>] [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

This is an experimental cmdlet.

Export policy assignment data.

By default the current subscription context will be exported. i.e Get-AzContext

Policy assignment data will be exported to the current working directory by default as JSON files, one per subscription.

All output files include a .assignment.json extension by default.

EXAMPLES

Example 1

Export-AzPolicyAssignmentData
Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---        26/03/2022   7:01 PM         740098   00000000-0000-0000-0000-000000000000.assignment.json

Export policy assignment data from current subscription context.

Example 2

Export-AzPolicyAssignmentData -Name '000000000000000000000000' -Scope '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PolicyRG'
Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---        26/03/2022   7:15 PM           4185   00000000-0000-0000-0000-000000000000.assignment.json

Export policy assignment with specific name and scope.

Example 3

Export-AzPolicyAssignmentData -Id '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PolicyRG/providers/Microsoft.Authorization/policyAssignments/000000000000000000000000'
Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---        26/03/2022   7:42 PM           4185   00000000-0000-0000-0000-00000000000.assignment.json

Export policy assignment with specific resource ID.

PARAMETERS

-Name

Specifies the name of the policy assignment.

Type: String
Parameter Sets: (Name)
Aliases:

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

-Id

Specifies the fully qualified resource ID for the policy assignment.

Type: String
Parameter Sets: (Id)
Aliases: AssignmentId

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

-Scope

Specifies the scope at which the policy is applied for the assignment.

Type: String
Parameter Sets: (Name, IncludeDescendent)
Aliases:

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

-PolicyDefinitionId

Specifies the ID of the policy definition of the policy assignment.

Type: String
Parameter Sets: (Name, Id)
Aliases:

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

-IncludeDescendent

Causes the list of returned policy assignments to include all assignments related to the given scope, including those from ancestor scopes and those from descendent scopes.

Type: String
Parameter Sets: (IncludeDescendent)
Aliases:

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

-OutputPath

The path to store generated JSON files containing policy assignment data.

Type: String
Parameter Sets: Default
Aliases:

Required: True
Position: Named
Default value: $PWD
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

By default, FileInfo objects are returned to the pipeline for each JSON file created. When -PassThru is specified, JSON files are not created and Azure resource objects are returned to the pipeline instead.

Type: SwitchParameter
Parameter Sets: Default
Aliases:

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.IO.FileInfo

Return FileInfo for each of the output files created, one per subscription context. This is the default.

PSObject

Return an object for each Azure resource, and configuration exported. This is returned when the -PassThru switch is used.

NOTES

RELATED LINKS