en-US/PSRule.Rules.Azure-help.xml
<?xml version="1.0" encoding="utf-8"?> <helpItems schema="maml" xmlns="http://msh"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-AzPolicyAssignmentData</command:name> <command:verb>Export</command:verb> <command:noun>AzPolicyAssignmentData</command:noun> <maml:description> <maml:para>Export policy assignment data.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>This is an experimental cmdlet.</maml:para> <maml:para>Export policy assignment data.</maml:para> <maml:para>By default the current subscription context will be exported. i.e `Get-AzContext`</maml:para> <maml:para>Policy assignment data will be exported to the current working directory by default as JSON files, one per subscription.</maml:para> <maml:para>All output files include a `.assignment.json` extension by default.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AssignmentId"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the fully qualified resource ID for the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:description> <maml:para>Specifies the scope at which the policy is applied for the assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PolicyDefinitionId</maml:name> <maml:description> <maml:para>Specifies the ID of the policy definition of the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:description> <maml:para>Specifies the scope at which the policy is applied for the assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PolicyDefinitionId</maml:name> <maml:description> <maml:para>Specifies the ID of the policy definition of the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeDescendent</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing policy assignment data.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AssignmentId"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the fully qualified resource ID for the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:description> <maml:para>Specifies the scope at which the policy is applied for the assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PolicyDefinitionId</maml:name> <maml:description> <maml:para>Specifies the ID of the policy definition of the policy assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeDescendent</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing policy assignment data.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description> <maml:para>Return `FileInfo` for each of the output files created, one per subscription context. This is the default.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>PSObject</maml:name> </dev:type> <maml:description> <maml:para>Return an object for each Azure resource, and configuration exported. This is returned when the `-PassThru` switch is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Export-AzPolicyAssignmentData Directory: C:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 26/03/2022 7:01 PM 740098 00000000-0000-0000-0000-000000000000.assignment.json</dev:code> <dev:remarks> <maml:para>Export policy assignment data from current subscription context.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>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</dev:code> <dev:remarks> <maml:para>Export policy assignment with specific name and scope.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>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</dev:code> <dev:remarks> <maml:para>Export policy assignment with specific resource ID.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Export-AzPolicyAssignmentData.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-AzPolicyAssignmentRuleData</command:name> <command:verb>Export</command:verb> <command:noun>AzPolicyAssignmentRuleData</command:noun> <maml:description> <maml:para>Export JSON based rules from policy assignment data.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>This is an experimental cmdlet.</maml:para> <maml:para>Export JSON based rules from policy assignment data.</maml:para> <maml:para>Policy assignment data generated from `Export-AzPolicyAssignmentData` is used to generate JSON rules.</maml:para> <maml:para>By default this is an offline process, requiring no connectivity to Azure.</maml:para> <maml:para>Policy definitions with the `Disabled` effect are ignored.</maml:para> <maml:para>The `subscription()` function will return the following unless overridden:</maml:para> <maml:para>- subscriptionId: 'ffffffff-ffff-ffff-ffff-ffffffffffff'</maml:para> <maml:para>- tenantId: 'ffffffff-ffff-ffff-ffff-ffffffffffff'</maml:para> <maml:para>- displayName: 'PSRule Test Subscription'</maml:para> <maml:para>- state: 'NotDefined'</maml:para> <maml:para></maml:para> <maml:para>The `resourceGroup()` function will return the following unless overridden:</maml:para> <maml:para>- name: 'ps-rule-test-rg'</maml:para> <maml:para>- location: 'eastus'</maml:para> <maml:para>- tags: { }</maml:para> <maml:para>- properties:</maml:para> <maml:para> - provisioningState: 'Succeeded'</maml:para> <maml:para>To override, set the `AZURE_SUBSCRIPTION` and `AZURE_RESOURCE_GROUP` in configuration.</maml:para> <maml:para>The rule prefix `Azure` is also applied to the policy names unless overridden with `-RulePrefix` or `AZURE_POLICY_RULE_PREFIX` in configuration.</maml:para> <maml:para>Currently the following limitations apply:</maml:para> <maml:para>- `field()` expressions are not expanded.</maml:para> <maml:para>- Field/Value count expressions are not supported.</maml:para> <maml:para>- Template functions with `value` cannot be expanded e.g. `"value": "[substring(field('name'), 0, 3)]"`.</maml:para> <maml:para>- Any of the above will lead to errors when emitting JSON rules.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-AzPolicyAssignmentRuleData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>The name of the assignment. If not specified `export-<xxxxxxxx>` will be used as the name of the assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>AssignmentFile</maml:name> <maml:description> <maml:para>The absolute or relative path to an assignment data file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> <maml:para>If this parameter is not specified, output will be written to the current working path. The file name `definitions-<name>.Rule.jsonc` will be used when this parameter is not set or a directory is specified. Where `<name>` is the name of the assignment specified by `-Name`.</maml:para> <maml:para>This parameter has no affect when `-PassThru` is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RulePrefix</maml:name> <maml:description> <maml:para>By default, policy rule names use the `Azure` prefix e.g. `Azure.Policy.e749c2d003da`.</maml:para> <maml:para>When `-RulePrefix` is specified, the default prefix is overridden.</maml:para> <maml:para>For example, with `-RulePrefix 'CustomPolicyPrefix'` this would generate the policy rule name `CustomPolicyPrefix.Policy.e749c2d003da`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ResourceGroupName"> <maml:name>ResourceGroup</maml:name> <maml:description> <maml:para>A name or hashtable of the Resource Group in the assignment data file. This Resource Group specified here will be used to resolve the `resourceGroup()` function.</maml:para> <maml:para>When the name of Resource Group is specified, the Resource Group will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Resource Group.</maml:para> <maml:para>Alternately, a hashtable of a Resource Group object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ResourceGroupReference</command:parameterValue> <dev:type> <maml:name>ResourceGroupReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>The name or hashtable of the Subscription in the assignment data file. This subscription specified here will be used to resolve the `subscription()` function.</maml:para> <maml:para>When a subscription name is specified, the Subscription will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Subscription.</maml:para> <maml:para>Alternately, a hashtable of a Subscription object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SubscriptionReference</command:parameterValue> <dev:type> <maml:name>SubscriptionReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>The name of the assignment. If not specified `export-<xxxxxxxx>` will be used as the name of the assignment.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>AssignmentFile</maml:name> <maml:description> <maml:para>The absolute or relative path to an assignment data file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> <maml:para>If this parameter is not specified, output will be written to the current working path. The file name `definitions-<name>.Rule.jsonc` will be used when this parameter is not set or a directory is specified. Where `<name>` is the name of the assignment specified by `-Name`.</maml:para> <maml:para>This parameter has no affect when `-PassThru` is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RulePrefix</maml:name> <maml:description> <maml:para>By default, policy rule names use the `Azure` prefix e.g. `Azure.Policy.e749c2d003da`.</maml:para> <maml:para>When `-RulePrefix` is specified, the default prefix is overridden.</maml:para> <maml:para>For example, with `-RulePrefix 'CustomPolicyPrefix'` this would generate the policy rule name `CustomPolicyPrefix.Policy.e749c2d003da`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ResourceGroupName"> <maml:name>ResourceGroup</maml:name> <maml:description> <maml:para>A name or hashtable of the Resource Group in the assignment data file. This Resource Group specified here will be used to resolve the `resourceGroup()` function.</maml:para> <maml:para>When the name of Resource Group is specified, the Resource Group will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Resource Group.</maml:para> <maml:para>Alternately, a hashtable of a Resource Group object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ResourceGroupReference</command:parameterValue> <dev:type> <maml:name>ResourceGroupReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>The name or hashtable of the Subscription in the assignment data file. This subscription specified here will be used to resolve the `subscription()` function.</maml:para> <maml:para>When a subscription name is specified, the Subscription will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Subscription.</maml:para> <maml:para>Alternately, a hashtable of a Subscription object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SubscriptionReference</command:parameterValue> <dev:type> <maml:name>SubscriptionReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Export-AzPolicyAssignmentRuleData -Name "policy" -AssignmentFile .\00000000-0000-0000-0000-000000000000.assignment.json Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 26/03/2022 9:41 PM 361 definitions-policy.Rule.jsonc</dev:code> <dev:remarks> <maml:para>Export JSON rules to file in current working directory.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>$subscription = @{ subscriptionId = 'nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn' displayName = 'My Azure Subscription' tenantId = 'nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn' } Export-AzPolicyAssignmentRuleData -Name "policy" -AssignmentFile .\00000000-0000-0000-0000-000000000000.assignment.json -Subscription $subscription Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 26/03/2022 9:41 PM 361 definitions-policy.Rule.jsonc</dev:code> <dev:remarks> <maml:para>Export JSON rules to file in current working directory using a specific subscription.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>Get-AzPolicyAssignmentDataSource | Export-AzPolicyAssignmentRuleData Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 27/03/2022 11:26 AM 721 definitions-export-1b474938.Rule.jsonc</dev:code> <dev:remarks> <maml:para>Export JSON rules from the current working directory using discovered assignment sources in the current working directory.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Export-AzPolicyAssignmentRuleData.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-AzRuleData</command:name> <command:verb>Export</command:verb> <command:noun>AzRuleData</command:noun> <maml:description> <maml:para>Export resource configuration data from one or more Azure subscriptions.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Export resource configuration data from deployed resources in one or more Azure subscriptions.</maml:para> <maml:para>If no filters are specified then the current subscription context will be exported. i.e. `Get-AzContext`</maml:para> <maml:para>To export all subscriptions contexts use the `-All` switch. When the `-All` switch is used, all subscriptions contexts will be exported. i.e. `Get-AzContext -ListAvailable`</maml:para> <maml:para>Resource data will be exported to the current working directory by default as JSON files, one per subscription.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-AzRuleData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>All</maml:name> <maml:description> <maml:para>By default, resources from the current subscription context are extracted. Use `-All` to extract resource data for all subscription contexts instead.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ResourceGroupName</maml:name> <maml:description> <maml:para>Optionally filter resources by Resource Group name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Tag</maml:name> <maml:description> <maml:para>Optionally filter resources based on tag.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue> <dev:type> <maml:name>Hashtable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Export-AzRuleData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ResourceGroupName</maml:name> <maml:description> <maml:para>Optionally filter resources by Resource Group name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>Optionally filter resources by subscription, Id or Name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Tag</maml:name> <maml:description> <maml:para>Optionally filter resources based on tag.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue> <dev:type> <maml:name>Hashtable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Optionally filter resources by a unique Tenant identifer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>All</maml:name> <maml:description> <maml:para>By default, resources from the current subscription context are extracted. Use `-All` to extract resource data for all subscription contexts instead.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ResourceGroupName</maml:name> <maml:description> <maml:para>Optionally filter resources by Resource Group name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>Optionally filter resources by subscription, Id or Name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Tag</maml:name> <maml:description> <maml:para>Optionally filter resources based on tag.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue> <dev:type> <maml:name>Hashtable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Optionally filter resources by a unique Tenant identifer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description> <maml:para>Return `FileInfo` for each of the output files created, one per subscription. This is the default.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>PSObject</maml:name> </dev:type> <maml:description> <maml:para>Return an object for each Azure resource, and configuration exported. This is returned when the `-PassThru` switch is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Export-AzRuleData Directory: C:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 1/07/2019 10:03 AM 7304948 00000000-0000-0000-0000-000000000001.json</dev:code> <dev:remarks> <maml:para>Export resource configuration data from current subscription context.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>Export-AzRuleData -Subscription 'Contoso Production', 'Contoso Non-production' Directory: C:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 1/07/2019 10:03 AM 7304948 00000000-0000-0000-0000-000000000001.json -a---- 1/07/2019 10:03 AM 7304948 00000000-0000-0000-0000-000000000002.json</dev:code> <dev:remarks> <maml:para>Export resource configuration data from subscriptions by name.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>Export-AzRuleData -ResourceGroupName 'rg-app1-web', 'rg-app1-db' Directory: C:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 1/07/2019 10:03 AM 7304948 00000000-0000-0000-0000-000000000001.json</dev:code> <dev:remarks> <maml:para>Export resource configuration data from two resource groups within the current subscription context.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Export-AzRuleData.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-AzRuleTemplateData</command:name> <command:verb>Export</command:verb> <command:noun>AzRuleTemplateData</command:noun> <maml:description> <maml:para>Export resource configuration data from Azure templates.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Export resource configuration data by merging Azure Resource Manager (ARM) template and parameter files. Template and parameters are merged by resolving template parameters, variables and functions.</maml:para> <maml:para>This function does not check template files for strict compliance with Azure schemas.</maml:para> <maml:para>By default this is an offline process, requiring no connectivity to Azure. Some functions that may be included in templates dynamically query Azure for current state. For these functions standard placeholder values are used by default. Functions that use placeholders include `reference`, `list*`.</maml:para> <maml:para>The `subscription()` function will return the following unless overridden:</maml:para> <maml:para>- subscriptionId: 'ffffffff-ffff-ffff-ffff-ffffffffffff'</maml:para> <maml:para>- tenantId: 'ffffffff-ffff-ffff-ffff-ffffffffffff'</maml:para> <maml:para>- displayName: 'PSRule Test Subscription'</maml:para> <maml:para>- state: 'NotDefined'</maml:para> <maml:para></maml:para> <maml:para>The `resourceGroup()` function will return the following unless overridden:</maml:para> <maml:para>- name: 'ps-rule-test-rg'</maml:para> <maml:para>- location: 'eastus'</maml:para> <maml:para>- tags: { }</maml:para> <maml:para>- properties:</maml:para> <maml:para> - provisioningState: 'Succeeded'</maml:para> <maml:para>To override, set the `AZURE_SUBSCRIPTION` and `AZURE_RESOURCE_GROUP` in configuration.</maml:para> <maml:para>Currently the following limitations apply:</maml:para> <maml:para>- Nested templates are expanded, external templates are not. - Deployment resources that link to an external template are returned as a resource. - Sub-resources such as diagnostic logs or configurations are automatically nested. Automatic nesting a sub-resource requires: - The parent resource is defined in the same template. - The sub-resource depends on the parent resource. - The `environment` template function always returns values for Azure public cloud.</maml:para> <maml:para>- References to Key Vault secrets are not expanded.</maml:para> <maml:para>A placeholder value is used instead. - The `reference()` function will return objects for resources within the same template. For resources that are not in the same template, a placeholder value is used instead. - Multi-line strings are not supported.</maml:para> <maml:para>- Template expressions up to a maximum of 100,000 characters are supported.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-AzRuleTemplateData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>The name of the deployment. If not specified `export-<xxxxxxxx>` will be used as the name of the deployment.</maml:para> <maml:para>This parameter is used by the `deployment()` function and is also used to name the output file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>TemplateFile</maml:name> <maml:description> <maml:para>The absolute or relative file path to an Azure Resource Manager template file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="TemplateParameterFile"> <maml:name>ParameterFile</maml:name> <maml:description> <maml:para>The absolute or relative file path to one or more Azure Resource Manager template parameter files.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> <maml:para>If this parameter is not specified, output will be written to the current working path. The file name `resources-<name>.json` will be used when this parameter is not set or a directory is specified. Where `<name>` is the name of the deployment specified by `-Name`.</maml:para> <maml:para>This parameter has no affect when `-PassThru` is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ResourceGroupName"> <maml:name>ResourceGroup</maml:name> <maml:description> <maml:para>A name or hashtable of the Resource Group where the deployment will occur. This Resource Group specified here will be used to resolve the `resourceGroup()` function.</maml:para> <maml:para>When the name of Resource Group is specified, the Resource Group will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Resource Group.</maml:para> <maml:para>Alternately, a hashtable of a Resource Group object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ResourceGroupReference</command:parameterValue> <dev:type> <maml:name>ResourceGroupReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>The name or hashtable of the Subscription where the deployment will occur. This subscription specified here will be used to resolve the `subscription()` function.</maml:para> <maml:para>When a subscription name is specified, the Subscription will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Subscription.</maml:para> <maml:para>Alternately, a hashtable of a Subscription object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SubscriptionReference</command:parameterValue> <dev:type> <maml:name>SubscriptionReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>The name of the deployment. If not specified `export-<xxxxxxxx>` will be used as the name of the deployment.</maml:para> <maml:para>This parameter is used by the `deployment()` function and is also used to name the output file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>TemplateFile</maml:name> <maml:description> <maml:para>The absolute or relative file path to an Azure Resource Manager template file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="TemplateParameterFile"> <maml:name>ParameterFile</maml:name> <maml:description> <maml:para>The absolute or relative file path to one or more Azure Resource Manager template parameter files.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputPath</maml:name> <maml:description> <maml:para>The path to store generated JSON files containing resources.</maml:para> <maml:para>If this parameter is not specified, output will be written to the current working path. The file name `resources-<name>.json` will be used when this parameter is not set or a directory is specified. Where `<name>` is the name of the deployment specified by `-Name`.</maml:para> <maml:para>This parameter has no affect when `-PassThru` is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ResourceGroupName"> <maml:name>ResourceGroup</maml:name> <maml:description> <maml:para>A name or hashtable of the Resource Group where the deployment will occur. This Resource Group specified here will be used to resolve the `resourceGroup()` function.</maml:para> <maml:para>When the name of Resource Group is specified, the Resource Group will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Resource Group.</maml:para> <maml:para>Alternately, a hashtable of a Resource Group object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ResourceGroupReference</command:parameterValue> <dev:type> <maml:name>ResourceGroupReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Subscription</maml:name> <maml:description> <maml:para>The name or hashtable of the Subscription where the deployment will occur. This subscription specified here will be used to resolve the `subscription()` function.</maml:para> <maml:para>When a subscription name is specified, the Subscription will be looked up and used during export. This requires an authenticated connection to Azure with permissions to read the specified Subscription.</maml:para> <maml:para>Alternately, a hashtable of a Subscription object can be specified. This option does not require an authenticated Azure connection. The hashtable will override the defaults for any specified properties.</maml:para> <maml:para>For more details see about_PSRule_Azure_Configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SubscriptionReference</command:parameterValue> <dev:type> <maml:name>SubscriptionReference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Export-AzRuleTemplateData -TemplateFile .\template.json -ParameterFile .\parameters.json;</dev:code> <dev:remarks> <maml:para>Export resource configuration data based on merging a template and parameter file together.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>Get-AzRuleTemplateLink | Export-AzRuleTemplateData;</dev:code> <dev:remarks> <maml:para>Recursively scan the current working path and export linked templates.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>$subscription = @{ subscriptionId = 'nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn' displayName = 'My Azure Subscription' tenantId = 'nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn' } Get-AzRuleTemplateLink | Export-AzRuleTemplateData -Subscription $subscription;</dev:code> <dev:remarks> <maml:para>Export linked templates from the current working path using a specific subscription.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 4 --------------------------</maml:title> <dev:code>$rg = @{ name = 'my-test-rg' location = 'australiaeast' tags = @{ env = 'prod' } } Get-AzRuleTemplateLink | Export-AzRuleTemplateData -ResourceGroup $rg;</dev:code> <dev:remarks> <maml:para>Export linked templates from the current working path using a specific resource group.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Export-AzRuleTemplateData.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-AzPolicyAssignmentDataSource</command:name> <command:verb>Get</command:verb> <command:noun>AzPolicyAssignmentDataSource</command:noun> <maml:description> <maml:para>Get policy assignment sources.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>This is an experimental cmdlet.</maml:para> <maml:para>Get policy assignment sources. By default `*.assignment.json` sources are discovered from the current working directory.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-AzPolicyAssignmentDataSource</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="p"> <maml:name>Path</maml:name> <maml:description> <maml:para>Sets the path to search for assignment files in. By default, this is the current working path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName)" position="named" aliases="f, AssignmentFile, FullName"> <maml:name>InputPath</maml:name> <maml:description> <maml:para>A path or filter to search for assignment files within the path specified by `-Path`. By default, files with `*.assignment.json` suffix will be used.</maml:para> <maml:para>When searching for assignment files all sub-directories will be scanned. To perform a shallow search, prefix input paths with `./`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'*.assignment.json'</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName)" position="named" aliases="f, AssignmentFile, FullName"> <maml:name>InputPath</maml:name> <maml:description> <maml:para>A path or filter to search for assignment files within the path specified by `-Path`. By default, files with `*.assignment.json` suffix will be used.</maml:para> <maml:para>When searching for assignment files all sub-directories will be scanned. To perform a shallow search, prefix input paths with `./`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'*.assignment.json'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="p"> <maml:name>Path</maml:name> <maml:description> <maml:para>Sets the path to search for assignment files in. By default, this is the current working path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>PSRule.Rules.Azure.Pipeline.PolicyAssignmentSource</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Get-AzPolicyAssignmentDataSource AssignmentFile -------------- C:\00000000-0000-0000-0000-000000000001.assignment.json C:\Users\user\00000000-0000-0000-0000-000000000002.assignment.json</dev:code> <dev:remarks> <maml:para>Gets policy assignment sources from any `*.assignment.json` sources within any folder in the current working directory path.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Get-AzPolicyAssignmentDataSource.md</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-AzRuleTemplateLink</command:name> <command:verb>Get</command:verb> <command:noun>AzRuleTemplateLink</command:noun> <maml:description> <maml:para>Get a metadata link to a Azure template file.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Gets a link between an Azure Resource Manager (ARM) parameter file and its referenced template file. Parameter files reference a template file by defining metadata. Alternatively, template files are discovered by naming convention.</maml:para> <maml:para>By default, when parameter files without a matching template are discovered an error is raised.</maml:para> <maml:para>To reference a template, set the `metadata.template` property to a file path. Referencing templates outside of the path specified with `-Path` is not permitted.</maml:para> <maml:para>To discover template files by naming convention:</maml:para> <maml:para>- Both template and parameter files must be in the same sub-directory.</maml:para> <maml:para>- The parameter file must end with `.parameters.json`.</maml:para> <maml:para>- The parameter file must be named `<templateName>.parameters.json`.</maml:para> <maml:para>- The template file must be named `<templateName>.json`.</maml:para> <maml:para></maml:para> <maml:para>For more information see the about_PSRule_Azure_Metadata_Link topic.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-AzRuleTemplateLink</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="p"> <maml:name>Path</maml:name> <maml:description> <maml:para>Sets the path to search for parameter files in. By default, this is the current working path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName)" position="1" aliases="f, TemplateParameterFile, FullName"> <maml:name>InputPath</maml:name> <maml:description> <maml:para>A path or filter to search for parameter files within the path specified by `-Path`. By default, files with `*.parameters.json` suffix will be used.</maml:para> <maml:para>When searching for parameter files all sub-directories will be scanned. To perform a shallow search, prefix input paths with `./`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'*.parameters.json'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipUnlinked</maml:name> <maml:description> <maml:para>Use this option to ignore parameter files that have no matching template. By default, when parameter files without a matching template are discovered an error is raised.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName)" position="1" aliases="f, TemplateParameterFile, FullName"> <maml:name>InputPath</maml:name> <maml:description> <maml:para>A path or filter to search for parameter files within the path specified by `-Path`. By default, files with `*.parameters.json` suffix will be used.</maml:para> <maml:para>When searching for parameter files all sub-directories will be scanned. To perform a shallow search, prefix input paths with `./`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>'*.parameters.json'</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipUnlinked</maml:name> <maml:description> <maml:para>Use this option to ignore parameter files that have no matching template. By default, when parameter files without a matching template are discovered an error is raised.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="p"> <maml:name>Path</maml:name> <maml:description> <maml:para>Sets the path to search for parameter files in. By default, this is the current working path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>PSRule.Rules.Azure.Data.Metadata.ITemplateLink</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>Get-AzRuleTemplateLink</dev:code> <dev:remarks> <maml:para>Get links from any `*.parameters.json` files within any folder in the current working path.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/Azure/PSRule.Rules.Azure/blob/main/docs/commands/Get-AzRuleTemplateLink.md</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSRule_Azure_Metadata_Link</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |