-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export Azure Policy assignments and linked definitions to a file #1266
Comments
Do you think these are appropriate Cmdlet parameters: function Export-AzPolicyAssignmentData {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $False)]
[String]$Name,
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)]
[String]$AssignmentFile,
[Parameter(Mandatory = $False)]
[String]$Scope,
[Parameter(Mandatory = $False)]
[String]$OutputPath = $PWD,
[Parameter(Mandatory = $False)]
[Switch]$PassThru = $False
)
} Where Might be worth bringing in an |
@ArmaanMcleod I'm not super clear on how the additional parameters would be used, Also how does Originally, I though that we would point to a scope and enumerate all assignments at that scope or higher, then find all the policy/ initiative definitions for those assignments. But if we have a different line of thinking then that is fine. |
@BernieWhite Yeah that was my thinking as well, was trying to line up this cmdlet with I'll review the other parameters as I'm doing this to see if they need to be added. I think two parameter sets like this would be useful: Export-AzPolicyAssignmentData -Name <string> [-Scope <string>] [-OutputPath <string>] [-PassThru] [<CommonParameters>]
Export-AzPolicyAssignmentData -Id <string> [-OutputPath <string>] [-PassThru] [<CommonParameters>] Gives the ability to pass in name & scope together(subscription default scope if not supplied), or a fully qualified resource ID. |
@ArmaanMcleod Ok sounds good. A tweak to that would be to make the |
@BernieWhite Thanks, will add that in 👍. Also wondering how we should handle contexts for this cmdlet? Should it just run from the default context or should we give the ability to set contexts with Export-AzPolicyAssignmentData [-Name <string>] [-Scope <string>] [-Subscription <string>] [-Tenant <string>] [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
Export-AzPolicyAssignmentData -Id <string> [-Subscription <string>] [-Tenant <string>] [-OutputPath <string>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>] Might be easier just to expect these parameters to be provided. |
@ArmaanMcleod It is a good point. Using one of No parameter or I adding If |
@BernieWhite Should this cmdlet enforce a naming standard on output files? Like I assume this will be needed for #1278 to visit the exported assignment files. |
@ArmaanMcleod Fine with that. It might make finding these files slightly faster. |
Related to #181, we should provide a way to export Azure Policy assignments and linked definitions to a file.
Default to subscription scope, and exclude defintions that are not assigned.
The text was updated successfully, but these errors were encountered: