external help file | Module Name | online version | schema |
---|---|---|---|
PSRule.Rules.Azure-help.xml |
PSRule.Rules.Azure |
2.0.0 |
Export resource configuration data from one or more Azure subscriptions.
Export-AzRuleData [[-OutputPath] <String>] [-Subscription <String[]>] [-Tenant <String[]>]
[-ResourceGroupName <String[]>] [-Tag <Hashtable>] [-PassThru] [-SkipDiscovery] [-ResourceId <String[]>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Export-AzRuleData [[-OutputPath] <String>] [-ResourceGroupName <String[]>] [-Tag <Hashtable>] [-PassThru]
[-All] [-WhatIf] [-Confirm] [<CommonParameters>]
Export resource configuration data from deployed resources in one or more Azure subscriptions.
If no filters are specified then the current subscription context will be exported. i.e. Get-AzContext
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
Resource data will be exported to the current working directory by default as JSON files, one per subscription.
Export-AzRuleData
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/07/2019 10:03 AM 7304948 00000000-0000-0000-0000-000000000001.json
Export resource configuration data from current subscription context.
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
Export resource configuration data from subscriptions by name.
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
Export resource configuration data from two resource groups within the current subscription context.
By default, resources from the current subscription context are extracted.
Use -All
to extract resource data for all subscription contexts instead.
Type: SwitchParameter
Parameter Sets: All
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path to store generated JSON files containing resources.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
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: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Optionally filter resources by Resource Group name.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Optionally filter resources by subscription, Id or Name.
Type: String[]
Parameter Sets: Default
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Optionally filter resources based on tag.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Optionally filter resources by a unique Tenant identifer.
Type: String[]
Parameter Sets: Default
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A list of resource Ids to expand.
Type: String[]
Parameter Sets: Default
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Determines if resource discovery is skipped. When skipped resources are expanded based on provided resource Ids.
Type: SwitchParameter
Parameter Sets: Default
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Return FileInfo
for each of the output files created, one per subscription.
This is the default.
Return an object for each Azure resource, and configuration exported.
This is returned when the -PassThru
switch is used.