diff --git a/src/CostManagement/docs/Az.Cost.md b/src/CostManagement/docs/Az.Cost.md new file mode 100644 index 000000000000..5b86051ab1b9 --- /dev/null +++ b/src/CostManagement/docs/Az.Cost.md @@ -0,0 +1,49 @@ +--- +Module Name: Az.Cost +Module Guid: e68ffeab-c2c5-4869-9306-c48c496e0cfd +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.cost +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Cost Module +## Description +Microsoft Azure PowerShell: Cost cmdlets + +## Az.Cost Cmdlets +### [Get-AzCostManagementExport](Get-AzCostManagementExport.md) +The operation to get the export for the defined scope by export name. + +### [Get-AzCostManagementExportExecutionHistory](Get-AzCostManagementExportExecutionHistory.md) +The operation to get the execution history of an export for the defined scope by export name. + +### [Invoke-AzCostManagementExecuteExport](Invoke-AzCostManagementExecuteExport.md) +The operation to execute a export. + +### [Invoke-AzCostManagementUsageQuery](Invoke-AzCostManagementUsageQuery.md) +Query the usage data for scope defined. + +### [New-AzCostManagementExport](New-AzCostManagementExport.md) +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + +### [New-AzCostManagementQueryColumnObject](New-AzCostManagementQueryColumnObject.md) +Create a in-memory object for QueryColumn + +### [New-AzCostManagementQueryComparisonExpressionObject](New-AzCostManagementQueryComparisonExpressionObject.md) +Create a in-memory object for QueryComparisonExpression + +### [New-AzCostManagementQueryFilterObject](New-AzCostManagementQueryFilterObject.md) +Create a in-memory object for QueryFilter + +### [Remove-AzCostManagementExport](Remove-AzCostManagementExport.md) +The operation to delete a export. + +### [Update-AzCostManagementExport](Update-AzCostManagementExport.md) +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + diff --git a/src/CostManagement/docs/Get-AzCostManagementExport.md b/src/CostManagement/docs/Get-AzCostManagementExport.md new file mode 100644 index 000000000000..62d9443ac1da --- /dev/null +++ b/src/CostManagement/docs/Get-AzCostManagementExport.md @@ -0,0 +1,164 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/get-azcostmanagementexport +schema: 2.0.0 +--- + +# Get-AzCostManagementExport + +## SYNOPSIS +The operation to get the export for the defined scope by export name. + +## SYNTAX + +### List (Default) +``` +Get-AzCostManagementExport -Scope [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzCostManagementExport -Name -Scope [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzCostManagementExport -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +The operation to get the export for the defined scope by export name. + +## EXAMPLES + +### Example 1: Get all cost management exports under a subscription +```powershell +PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +TestExport1 Microsoft.CostManagement/exports +``` + +this command gets all cost management exports under a subscription. + +### Example 2: Get a cost management export by name +```powershell +PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport' + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +``` + +This command gets a cost management export by name. + +### Example 3: Get a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport' +PS C:\> Get-AzCostManagementExport -InputObject $export + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +``` + +This command gets a cost management export by object. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Export Name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: ExportName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExport + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/Get-AzCostManagementExportExecutionHistory.md b/src/CostManagement/docs/Get-AzCostManagementExportExecutionHistory.md new file mode 100644 index 000000000000..bc7a61e0105a --- /dev/null +++ b/src/CostManagement/docs/Get-AzCostManagementExportExecutionHistory.md @@ -0,0 +1,151 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/get-azcostmanagementexportexecutionhistory +schema: 2.0.0 +--- + +# Get-AzCostManagementExportExecutionHistory + +## SYNOPSIS +The operation to get the execution history of an export for the defined scope by export name. + +## SYNTAX + +### Get (Default) +``` +Get-AzCostManagementExportExecutionHistory -ExportName -Scope [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzCostManagementExportExecutionHistory -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +The operation to get the execution history of an export for the defined scope by export name. + +## EXAMPLES + +### Example 1: Get execution history of cost management export +```powershell +PS C:\> Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t" + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +OnDemand 6/29/2020 6:03:26 AM 6/29/2020 6:04:28 AM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_041c4d56-f25e-4e37-99fb-ab201309e07f.csv +Scheduled 6/30/2020 12:02:53 PM 6/30/2020 12:03:34 PM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_cd5bd8b1-014f-4521-b20a-69168288263d.csv +``` + +This command gets execution history of cost management export. + +### Example 2: Get execution history of cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t" +PS C:\> $export | Get-AzCostManagementExportExecutionHistory -InputObject $export + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +OnDemand 6/29/2020 6:03:26 AM 6/29/2020 6:04:28 AM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_041c4d56-f25e-4e37-99fb-ab201309e07f.csv +Scheduled 6/30/2020 12:02:53 PM 6/30/2020 12:03:34 PM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_cd5bd8b1-014f-4521-b20a-69168288263d.csv +``` + +This command gets execution history of cost management export by object. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExportName +Export Name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExportExecution + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/Invoke-AzCostManagementExecuteExport.md b/src/CostManagement/docs/Invoke-AzCostManagementExecuteExport.md new file mode 100644 index 000000000000..4292ec7cd0af --- /dev/null +++ b/src/CostManagement/docs/Invoke-AzCostManagementExecuteExport.md @@ -0,0 +1,189 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/invoke-azcostmanagementexecuteexport +schema: 2.0.0 +--- + +# Invoke-AzCostManagementExecuteExport + +## SYNOPSIS +The operation to execute a export. + +## SYNTAX + +### Execute (Default) +``` +Invoke-AzCostManagementExecuteExport -ExportName -Scope [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### ExecuteViaIdentity +``` +Invoke-AzCostManagementExecuteExport -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to execute a export. + +## EXAMPLES + +### Example 1: Invoke a cost mangement export by name +```powershell +PS C:\> Invoke-AzCostManagementExecuteExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName 'TestExport' + +``` + +This command invokes a cost mangement export by name. + +### Example 2: Invoke a cost mangement export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName 'TestExport' +PS C:\> Invoke-AzCostManagementExecuteExport -InputObject $export + +``` + +This command invokes a cost mangement export by object. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExportName +Export Name. + +```yaml +Type: System.String +Parameter Sets: Execute +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: ExecuteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: Execute +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/Invoke-AzCostManagementUsageQuery.md b/src/CostManagement/docs/Invoke-AzCostManagementUsageQuery.md new file mode 100644 index 000000000000..5d5d41a614d2 --- /dev/null +++ b/src/CostManagement/docs/Invoke-AzCostManagementUsageQuery.md @@ -0,0 +1,354 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/invoke-azcostmanagementusagequery +schema: 2.0.0 +--- + +# Invoke-AzCostManagementUsageQuery + +## SYNOPSIS +Query the usage data for scope defined. + +## SYNTAX + +### UsageExpanded (Default) +``` +Invoke-AzCostManagementUsageQuery -Scope -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UsageExpanded1 +``` +Invoke-AzCostManagementUsageQuery -ExternalCloudProviderId + -ExternalCloudProviderType -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UsageViaIdentityExpanded +``` +Invoke-AzCostManagementUsageQuery -InputObject -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UsageViaIdentityExpanded1 +``` +Invoke-AzCostManagementUsageQuery -InputObject -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Query the usage data for scope defined. + +## EXAMPLES + +### Example 1: Invoke query usage of the cost management export +```powershell +PS C:\> Invoke-AzCostManagementUsageQuery -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'daily' + +NextLink Column Row +-------- ------ --- + {UsageDate, Currency} {20200701 USD, 20200702 USD, 20200703 USD, 20200704 USD…} +``` + +this command invokes query usage of the cost management export. + +## PARAMETERS + +### -ConfigurationColumn +Array of column names to be included in the query. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetAggregation +Dictionary of aggregation expression to use in the query. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetFilter +Has filter expression to use in the query. +To construct, see NOTES section for DATASETFILTER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGranularity +The granularity of rows in the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.GranularityType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGrouping +Array of group by expression to use in the query. +To construct, see NOTES section for DATASETGROUPING properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryGrouping[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExternalCloudProviderId +This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + +```yaml +Type: System.String +Parameter Sets: UsageExpanded1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExternalCloudProviderType +The external cloud provider type associated with dimension/query operations. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.ExternalCloudProviderType +Parameter Sets: UsageExpanded1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: UsageViaIdentityExpanded, UsageViaIdentityExpanded1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. + +```yaml +Type: System.String +Parameter Sets: UsageExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Timeframe +The time frame for pulling data for the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.TimeframeType +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodFrom +The start date to pull data from. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodTo +The end date to pull data to. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +The type of the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.ExportType +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryResult + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +DATASETFILTER : Has filter expression to use in the query. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +DATASETGROUPING : Array of group by expression to use in the query. + - `Name `: The name of the column to group. + - `Type `: Has type of the column to group. + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/New-AzCostManagementExport.md b/src/CostManagement/docs/New-AzCostManagementExport.md new file mode 100644 index 000000000000..bd0157d8f473 --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementExport.md @@ -0,0 +1,449 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/new-azcostmanagementexport +schema: 2.0.0 +--- + +# New-AzCostManagementExport + +## SYNOPSIS +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + +## SYNTAX + +``` +New-AzCostManagementExport -Name -Scope [-ConfigurationColumn ] + [-DatasetAggregation ] [-DatasetFilter ] [-DatasetGranularity ] + [-DatasetGrouping ] [-DefinitionTimeframe ] [-DefinitionType ] + [-DestinationContainer ] [-DestinationResourceId ] [-DestinationRootFolderPath ] + [-Format ] [-RecurrencePeriodFrom ] [-RecurrencePeriodTo ] + [-ScheduleRecurrence ] [-ScheduleStatus ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + +## EXAMPLES + +### Example 1: Create a cost management export for a subscription +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3388-4e19-88eb-0975f02ac87f" -Name costexport-test -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom (Get-Date).ToString() -RecurrencePeriodTo (Get-Date).AddDays(20).ToString() -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" + +Name Type +---- ---- +costexport-test Microsoft.CostManagement/exports +``` + +This command creates a cost management export for the resource group for a subscription. + +### Example 2: Create a cost management export with custom column for the resource group +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps-rg-t" -Name "ps-customcolum-t" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" -RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" -ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') + +Name Type +---- ---- +ps-customcolum-t Microsoft.CostManagement/exports +``` + +This command creates a cost management export with custom column for the resource group. + +### Example 3: Create a cost management export with custom column for the resource group +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps-rg-t" -Name "ps-customcolum-t" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" -RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" -ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') + +Name Type +---- ---- +ps-customcolum-t Microsoft.CostManagement/exports +``` + +This command creates a cost management export with custom column for the resource group. + +## PARAMETERS + +### -ConfigurationColumn +Array of column names to be included in the query. +Any valid query column name is allowed. +If not provided, then query includes all columns. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetAggregation +Dictionary of aggregation expression to use in the query. +The key of each item in the dictionary is the alias for the aggregated column. +Query can have up to 2 aggregation clauses. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetFilter +Has filter expression to use in the query. +To construct, see NOTES section for DATASETFILTER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGranularity +The granularity of rows in the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.GranularityType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGrouping +Array of group by expression to use in the query. +Query can have up to 2 group by clauses. +To construct, see NOTES section for DATASETGROUPING properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryGrouping[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefinitionTimeframe +The time frame for pulling data for the query. +If custom, then a specific time period must be provided. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.TimeframeType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefinitionType +The type of the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.ExportType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationContainer +The name of the container where exports will be uploaded. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationResourceId +The resource id of the storage account where exports will be delivered. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationRootFolderPath +The name of the directory where exports will be uploaded. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Format +The format of the export being delivered. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.FormatType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Export Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: ExportName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecurrencePeriodFrom +The start date of recurrence. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecurrencePeriodTo +The end date of recurrence. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScheduleRecurrence +The schedule recurrence. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.RecurrenceType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScheduleStatus +The status of the schedule. +Whether active or not. +If inactive, the export's scheduled execution is paused. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.StatusType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodFrom +The start date to pull data from. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodTo +The end date to pull data to. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExport + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +DATASETFILTER : Has filter expression to use in the query. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +DATASETGROUPING : Array of group by expression to use in the query. Query can have up to 2 group by clauses. + - `Name `: The name of the column to group. + - `Type `: Has type of the column to group. + +## RELATED LINKS + diff --git a/src/CostManagement/docs/New-AzCostManagementQueryColumnObject.md b/src/CostManagement/docs/New-AzCostManagementQueryColumnObject.md new file mode 100644 index 000000000000..8e945d1febd0 --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementQueryColumnObject.md @@ -0,0 +1,81 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.CostManagement/new-AzCostManagementQueryColumnObject +schema: 2.0.0 +--- + +# New-AzCostManagementQueryColumnObject + +## SYNOPSIS +Create a in-memory object for QueryColumn + +## SYNTAX + +``` +New-AzCostManagementQueryColumnObject [-Name ] [-Type ] [] +``` + +## DESCRIPTION +Create a in-memory object for QueryColumn + +## EXAMPLES + +### Example 1: Create a column object of query for cost management export +```powershell +PS C:\> New-AzCostManagementQueryColumnObject -Name 'SubscriptionGuid' -Type 'string' + +Name Type +---- ---- +SubscriptionGuid string +``` + +This command creates a column object of query for cost management export. + +## PARAMETERS + +### -Name +The name of column. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +The type of column. + +```yaml +Type: System.String +Parameter Sets: (All) +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryColumn + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/CostManagement/docs/New-AzCostManagementQueryComparisonExpressionObject.md b/src/CostManagement/docs/New-AzCostManagementQueryComparisonExpressionObject.md new file mode 100644 index 000000000000..8c5fdaa4dcaf --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementQueryComparisonExpressionObject.md @@ -0,0 +1,97 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.CostManagement/new-AzCostManagementQueryComparisonExpressionObject +schema: 2.0.0 +--- + +# New-AzCostManagementQueryComparisonExpressionObject + +## SYNOPSIS +Create a in-memory object for QueryComparisonExpression + +## SYNTAX + +``` +New-AzCostManagementQueryComparisonExpressionObject -Name -Operator -Value + [] +``` + +## DESCRIPTION +Create a in-memory object for QueryComparisonExpression + +## EXAMPLES + +### Example 1: Create a comparison expression object of query for cost management export +```powershell +PS C:\> New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') + +Name Operator Value +---- -------- ----- +ResourceLocation In {East US, West Europe} +``` + +This command creates a comparison expression object of query for cost management export. + +## PARAMETERS + +### -Name +The name of the column to use in comparison. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Operator +The operator to use for comparison. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.OperatorType +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Array of values to use for comparison. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: True +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryComparisonExpression + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/CostManagement/docs/New-AzCostManagementQueryFilterObject.md b/src/CostManagement/docs/New-AzCostManagementQueryFilterObject.md new file mode 100644 index 000000000000..155f6a51c902 --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementQueryFilterObject.md @@ -0,0 +1,183 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.CostManagement/new-AzCostManagementQueryFilterObject +schema: 2.0.0 +--- + +# New-AzCostManagementQueryFilterObject + +## SYNOPSIS +Create a in-memory object for QueryFilter + +## SYNTAX + +``` +New-AzCostManagementQueryFilterObject [-And ] [-Dimension ] + [-Not ] [-Or ] [-Tag ] [] +``` + +## DESCRIPTION +Create a in-memory object for QueryFilter + +## EXAMPLES + +### Example 1: Create a filter object of query for cost management export +```powershell +PS C:\> $orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') +PS C:\> $orTag = New-AzCostManagementQueryComparisonExpressionObject -Name 'Environment' -Operator In -Value @('UAT', 'Prod') +PS C:\> New-AzCostManagementQueryFilterObject -or @((New-AzCostManagementQueryFilterObject -Dimension $orDimension), (New-AzCostManagementQueryFilterObject -Tag $orTag)) + +And : +Dimension : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryComparisonExpression +Not : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter +Or : {Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter, Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter} +Tag : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryComparisonExpression +``` + +this command creates a filter object of query for cost management export. + +## PARAMETERS + +### -And +The logical "AND" expression. +Must have at least 2 items. +To construct, see NOTES section for AND properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Dimension +Has comparison expression for a dimension. +To construct, see NOTES section for DIMENSION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryComparisonExpression +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Not +The logical "NOT" expression. +To construct, see NOTES section for NOT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Or +The logical "OR" expression. +Must have at least 2 items. +To construct, see NOTES section for OR properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Has comparison expression for a tag. +To construct, see NOTES section for TAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryComparisonExpression +Parameter Sets: (All) +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +AND : The logical "AND" expression. Must have at least 2 items. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +DIMENSION : Has comparison expression for a dimension. + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + +NOT : The logical "NOT" expression. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +OR : The logical "OR" expression. Must have at least 2 items. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +TAG : Has comparison expression for a tag. + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + +## RELATED LINKS + diff --git a/src/CostManagement/docs/Remove-AzCostManagementExport.md b/src/CostManagement/docs/Remove-AzCostManagementExport.md new file mode 100644 index 000000000000..4fa7d6859e00 --- /dev/null +++ b/src/CostManagement/docs/Remove-AzCostManagementExport.md @@ -0,0 +1,189 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/remove-azcostmanagementexport +schema: 2.0.0 +--- + +# Remove-AzCostManagementExport + +## SYNOPSIS +The operation to delete a export. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzCostManagementExport -Name -Scope [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzCostManagementExport -InputObject [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a export. + +## EXAMPLES + +### Example 1: Remove a cost management export by name +```powershell +PS C:\> Remove-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name AzureExport-T01 + +``` + +This command removes a cost management export by name + +### Example 2: Remove a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name AzureExport-T02 +PS C:\> Remove-AzCostManagementExport -InputObject $export + +``` + +This command removes a cost management export by object + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Export Name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: ExportName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/Update-AzCostManagementExport.md b/src/CostManagement/docs/Update-AzCostManagementExport.md new file mode 100644 index 000000000000..a070d66d45c3 --- /dev/null +++ b/src/CostManagement/docs/Update-AzCostManagementExport.md @@ -0,0 +1,470 @@ +--- +external help file: +Module Name: Az.Cost +online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/update-azcostmanagementexport +schema: 2.0.0 +--- + +# Update-AzCostManagementExport + +## SYNOPSIS +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzCostManagementExport -Name -Scope [-ConfigurationColumn ] + [-DatasetAggregation ] [-DatasetFilter ] [-DatasetGranularity ] + [-DatasetGrouping ] [-DefinitionTimeframe ] [-DefinitionType ] + [-DestinationContainer ] [-DestinationResourceId ] [-DestinationRootFolderPath ] + [-Format ] [-RecurrencePeriodFrom ] [-RecurrencePeriodTo ] + [-ScheduleRecurrence ] [-ScheduleStatus ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzCostManagementExport -InputObject [-ConfigurationColumn ] + [-DatasetAggregation ] [-DatasetFilter ] [-DatasetGranularity ] + [-DatasetGrouping ] [-DefinitionTimeframe ] [-DefinitionType ] + [-DestinationContainer ] [-DestinationResourceId ] [-DestinationRootFolderPath ] + [-Format ] [-RecurrencePeriodFrom ] [-RecurrencePeriodTo ] + [-ScheduleRecurrence ] [-ScheduleStatus ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a export. +Update operation requires latest eTag to be set in the request. +You may obtain the latest eTag by performing a get operation. +Create operation does not require eTag. + +## EXAMPLES + +### Example 1: Update a cost management export by name +```powershell +PS C:\> Update-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name exportinfo-ps-t -RecurrencePeriodFrom (Get-Date).ToString() + +``` + +This command updates a cost management export by name. + +### Example 2: Update a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name exportinfo-ps-t +PS C:\> Update-AzCostManagementExport -InputObject $export -RecurrencePeriodFrom (Get-Date).ToString() + +{{ Add output here }} +``` + +This command updates a cost management export by object. + +## PARAMETERS + +### -ConfigurationColumn +Array of column names to be included in the query. +Any valid query column name is allowed. +If not provided, then query includes all columns. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetAggregation +Dictionary of aggregation expression to use in the query. +The key of each item in the dictionary is the alias for the aggregated column. +Query can have up to 2 aggregation clauses. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetFilter +Has filter expression to use in the query. +To construct, see NOTES section for DATASETFILTER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryFilter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGranularity +The granularity of rows in the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.GranularityType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasetGrouping +Array of group by expression to use in the query. +Query can have up to 2 group by clauses. +To construct, see NOTES section for DATASETGROUPING properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IQueryGrouping[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefinitionTimeframe +The time frame for pulling data for the query. +If custom, then a specific time period must be provided. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.TimeframeType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefinitionType +The type of the query. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.ExportType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationContainer +The name of the container where exports will be uploaded. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationResourceId +The resource id of the storage account where exports will be delivered. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationRootFolderPath +The name of the directory where exports will be uploaded. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Format +The format of the export being delivered. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.FormatType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Export Name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: ExportName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecurrencePeriodFrom +The start date of recurrence. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecurrencePeriodTo +The end date of recurrence. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScheduleRecurrence +The schedule recurrence. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.RecurrenceType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScheduleStatus +The status of the schedule. +Whether active or not. +If inactive, the export's scheduled execution is paused. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Support.StatusType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +The scope associated with query and export operations. +This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodFrom +The start date to pull data from. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimePeriodTo +The end date to pull data to. + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExport + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +DATASETFILTER : Has filter expression to use in the query. + - `[And ]`: The logical "AND" expression. Must have at least 2 items. + - `[Dimension ]`: Has comparison expression for a dimension + - `Name `: The name of the column to use in comparison. + - `Operator `: The operator to use for comparison. + - `Value `: Array of values to use for comparison + - `[Not ]`: The logical "NOT" expression. + - `[Or ]`: The logical "OR" expression. Must have at least 2 items. + - `[Tag ]`: Has comparison expression for a tag + +DATASETGROUPING : Array of group by expression to use in the query. Query can have up to 2 group by clauses. + - `Name `: The name of the column to group. + - `Type `: Has type of the column to group. + +INPUTOBJECT : Identity Parameter + - `[AlertId ]`: Alert ID + - `[ExportName ]`: Export Name. + - `[ExternalCloudProviderId ]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + - `[ExternalCloudProviderType ]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + - `[Id ]`: Resource identity path + - `[Scope ]`: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + - `[ViewName ]`: View name + +## RELATED LINKS + diff --git a/src/CostManagement/docs/readme.md b/src/CostManagement/docs/readme.md new file mode 100644 index 000000000000..f4b0a6692c57 --- /dev/null +++ b/src/CostManagement/docs/readme.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.Cost` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `../examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.Cost` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `../exports` folder. Additionally, when writing custom cmdlets in the `../custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `../examples` folder. \ No newline at end of file diff --git a/src/CostManagement/examples/Get-AzCostManagementExport.md b/src/CostManagement/examples/Get-AzCostManagementExport.md new file mode 100644 index 000000000000..9284c2af98bc --- /dev/null +++ b/src/CostManagement/examples/Get-AzCostManagementExport.md @@ -0,0 +1,35 @@ +### Example 1: Get all cost management exports under a subscription +```powershell +PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +TestExport1 Microsoft.CostManagement/exports +``` + +this command gets all cost management exports under a subscription. + +### Example 2: Get a cost management export by name +```powershell +PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport' + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +``` + +This command gets a cost management export by name. + +### Example 3: Get a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport' +PS C:\> Get-AzCostManagementExport -InputObject $export + +Name Type +---- ---- +TestExport Microsoft.CostManagement/exports +``` + +This command gets a cost management export by object. + diff --git a/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md b/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md new file mode 100644 index 000000000000..ac37f614271f --- /dev/null +++ b/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md @@ -0,0 +1,25 @@ +### Example 1: Get execution history of cost management export +```powershell +PS C:\> Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t" + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +OnDemand 6/29/2020 6:03:26 AM 6/29/2020 6:04:28 AM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_041c4d56-f25e-4e37-99fb-ab201309e07f.csv +Scheduled 6/30/2020 12:02:53 PM 6/30/2020 12:03:34 PM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_cd5bd8b1-014f-4521-b20a-69168288263d.csv +``` + +This command gets execution history of cost management export. + +### Example 2: Get execution history of cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t" +PS C:\> $export | Get-AzCostManagementExportExecutionHistory -InputObject $export + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +OnDemand 6/29/2020 6:03:26 AM 6/29/2020 6:04:28 AM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_041c4d56-f25e-4e37-99fb-ab201309e07f.csv +Scheduled 6/30/2020 12:02:53 PM 6/30/2020 12:03:34 PM Completed ad-hoc/ps-customcolum-t/20200601-20200630/ps-customcolum-t_cd5bd8b1-014f-4521-b20a-69168288263d.csv +``` + +This command gets execution history of cost management export by object. + diff --git a/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md b/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md new file mode 100644 index 000000000000..098474f3093f --- /dev/null +++ b/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md @@ -0,0 +1,17 @@ +### Example 1: Invoke a cost mangement export by name +```powershell +PS C:\> Invoke-AzCostManagementExecuteExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName 'TestExport' + +``` + +This command invokes a cost mangement export by name. + +### Example 2: Invoke a cost mangement export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName 'TestExport' +PS C:\> Invoke-AzCostManagementExecuteExport -InputObject $export + +``` + +This command invokes a cost mangement export by object. + diff --git a/src/CostManagement/examples/Invoke-AzCostManagementUsageQuery.md b/src/CostManagement/examples/Invoke-AzCostManagementUsageQuery.md new file mode 100644 index 000000000000..5ec9865f3c8c --- /dev/null +++ b/src/CostManagement/examples/Invoke-AzCostManagementUsageQuery.md @@ -0,0 +1,12 @@ +### Example 1: Invoke query usage of the cost management export +```powershell +PS C:\> Invoke-AzCostManagementUsageQuery -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'daily' + +NextLink Column Row +-------- ------ --- + {UsageDate, Currency} {20200701 USD, 20200702 USD, 20200703 USD, 20200704 USD…} +``` + +this command invokes query usage of the cost management export. + + diff --git a/src/CostManagement/examples/New-AzCostManagementExport.md b/src/CostManagement/examples/New-AzCostManagementExport.md new file mode 100644 index 000000000000..17fbb44a71e2 --- /dev/null +++ b/src/CostManagement/examples/New-AzCostManagementExport.md @@ -0,0 +1,37 @@ +### Example 1: Create a cost management export for a subscription +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3388-4e19-88eb-0975f02ac87f" -Name costexport-test -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom (Get-Date).ToString() -RecurrencePeriodTo (Get-Date).AddDays(20).ToString() -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" + +Name Type +---- ---- +costexport-test Microsoft.CostManagement/exports +``` + +This command creates a cost management export for the resource group for a subscription. + +### Example 2: Create a cost management export with custom column for the resource group +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps-rg-t" -Name "ps-customcolum-t" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" -RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" -ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') + +Name Type +---- ---- +ps-customcolum-t Microsoft.CostManagement/exports +``` + +This command creates a cost management export with custom column for the resource group. + +### Example 3: Create a cost management export with custom column for the resource group +```powershell +PS C:\> $storageAccount = Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount" +PS C:\> New-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azps-rg-t" -Name "ps-customcolum-t" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" -RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" -DestinationResourceId $storageAccount.Id -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" -ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') + +Name Type +---- ---- +ps-customcolum-t Microsoft.CostManagement/exports +``` + +This command creates a cost management export with custom column for the resource group. + + diff --git a/src/CostManagement/examples/New-AzCostManagementQueryColumnObject.md b/src/CostManagement/examples/New-AzCostManagementQueryColumnObject.md new file mode 100644 index 000000000000..a043890b74ba --- /dev/null +++ b/src/CostManagement/examples/New-AzCostManagementQueryColumnObject.md @@ -0,0 +1,12 @@ +### Example 1: Create a column object of query for cost management export +```powershell +PS C:\> New-AzCostManagementQueryColumnObject -Name 'SubscriptionGuid' -Type 'string' + +Name Type +---- ---- +SubscriptionGuid string +``` + +This command creates a column object of query for cost management export. + + diff --git a/src/CostManagement/examples/New-AzCostManagementQueryComparisonExpressionObject.md b/src/CostManagement/examples/New-AzCostManagementQueryComparisonExpressionObject.md new file mode 100644 index 000000000000..89f150db32d7 --- /dev/null +++ b/src/CostManagement/examples/New-AzCostManagementQueryComparisonExpressionObject.md @@ -0,0 +1,11 @@ +### Example 1: Create a comparison expression object of query for cost management export +```powershell +PS C:\> New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') + +Name Operator Value +---- -------- ----- +ResourceLocation In {East US, West Europe} +``` + +This command creates a comparison expression object of query for cost management export. + diff --git a/src/CostManagement/examples/New-AzCostManagementQueryFilterObject.md b/src/CostManagement/examples/New-AzCostManagementQueryFilterObject.md new file mode 100644 index 000000000000..7529b75a1502 --- /dev/null +++ b/src/CostManagement/examples/New-AzCostManagementQueryFilterObject.md @@ -0,0 +1,15 @@ +### Example 1: Create a filter object of query for cost management export +```powershell +PS C:\> $orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') +PS C:\> $orTag = New-AzCostManagementQueryComparisonExpressionObject -Name 'Environment' -Operator In -Value @('UAT', 'Prod') +PS C:\> New-AzCostManagementQueryFilterObject -or @((New-AzCostManagementQueryFilterObject -Dimension $orDimension), (New-AzCostManagementQueryFilterObject -Tag $orTag)) + +And : +Dimension : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryComparisonExpression +Not : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter +Or : {Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter, Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryFilter} +Tag : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.QueryComparisonExpression +``` + +this command creates a filter object of query for cost management export. + diff --git a/src/CostManagement/examples/Remove-AzCostManagementExport.md b/src/CostManagement/examples/Remove-AzCostManagementExport.md new file mode 100644 index 000000000000..659951472332 --- /dev/null +++ b/src/CostManagement/examples/Remove-AzCostManagementExport.md @@ -0,0 +1,17 @@ +### Example 1: Remove a cost management export by name +```powershell +PS C:\> Remove-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name AzureExport-T01 + +``` + +This command removes a cost management export by name + +### Example 2: Remove a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name AzureExport-T02 +PS C:\> Remove-AzCostManagementExport -InputObject $export + +``` + +This command removes a cost management export by object + diff --git a/src/CostManagement/examples/Update-AzCostManagementExport.md b/src/CostManagement/examples/Update-AzCostManagementExport.md new file mode 100644 index 000000000000..c9c388d50cb2 --- /dev/null +++ b/src/CostManagement/examples/Update-AzCostManagementExport.md @@ -0,0 +1,18 @@ +### Example 1: Update a cost management export by name +```powershell +PS C:\> Update-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name exportinfo-ps-t -RecurrencePeriodFrom (Get-Date).ToString() + +``` + +This command updates a cost management export by name. + +### Example 2: Update a cost management export by object +```powershell +PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name exportinfo-ps-t +PS C:\> Update-AzCostManagementExport -InputObject $export -RecurrencePeriodFrom (Get-Date).ToString() + +{{ Add output here }} +``` + +This command updates a cost management export by object. + diff --git a/src/CostManagement/readme.md b/src/CostManagement/readme.md index 3b2c2ae143ee..99b8c111a0ff 100644 --- a/src/CostManagement/readme.md +++ b/src/CostManagement/readme.md @@ -140,4 +140,4 @@ directive: - no-inline: - QueryFilter - ReportConfigFilter -``` +``` \ No newline at end of file diff --git a/src/CostManagement/test/Az.Cost-TestResults.xml b/src/CostManagement/test/Az.Cost-TestResults.xml new file mode 100644 index 000000000000..f4779bc6f02e --- /dev/null +++ b/src/CostManagement/test/Az.Cost-TestResults.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/CostManagement/test/Get-AzCostManagementExport.Recording.json b/src/CostManagement/test/Get-AzCostManagementExport.Recording.json new file mode 100644 index 000000000000..8c587b73557f --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExport.Recording.json @@ -0,0 +1,166 @@ +{ + "Get-AzCostManagementExport+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "a3d1a493-26a8-4a52-8208-0fbd285d32a1" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "7a79246a-3f52-44f2-b629-21dfcd3cac72" ], + "x-ms-request-id": [ "c1a1f8d5-2748-4024-89cf-e4736e709d25" ], + "x-ms-correlation-request-id": [ "a0cfd64c-b052-4ecf-b529-07ff98840e55" ], + "x-ms-client-request-id": [ "a3d1a493-26a8-4a52-8208-0fbd285d32a1" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091501Z:a0cfd64c-b052-4ecf-b529-07ff98840e55" ], + "Date": [ "Mon, 06 Jul 2020 09:15:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "23920" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport\",\"name\":\"TestExport\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb46c1f5154\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T00:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport1\",\"name\":\"TestExport1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb4a3f75019\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T20:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport2\",\"name\":\"TestExport2\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f5dda56551\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport3\",\"name\":\"TestExport3\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6069c44bb\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport4\",\"name\":\"TestExport4\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6425d3647\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport5\",\"name\":\"TestExport5\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f679d78775\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport6\",\"name\":\"TestExport6\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6b27ba29f\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T02\",\"name\":\"LucasExport-T02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f8ec7b1149\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T03\",\"name\":\"LucasExport-T03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f918708873\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExportT06\",\"name\":\"LucasExportT06\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f9d2f5df21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-27T20:00:00+00:00\",\"to\":\"2020-06-28T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t01\",\"name\":\"ps-costext-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649ff52ae2bb7\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-24T00:00:00+00:00\",\"to\":\"2020-06-26T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t02\",\"name\":\"ps-costext-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d16faa5d7b4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T00:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t03\",\"name\":\"ps-costext-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1be92e19a4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:45:28\",\"to\":\"2020-07-18T07:15:28\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportws5qlv\",\"name\":\"exportws5qlv\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1d1164c9ac\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:53:46\",\"to\":\"2020-07-18T07:23:46\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmkjhje\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t01\",\"name\":\"manual-export-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd725acbcdf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T20:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t02\",\"name\":\"manual-export-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd8071bf283\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportinfo-ps-t\",\"name\":\"exportinfo-ps-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda275a663c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t\",\"name\":\"ps-exportall-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda37395609\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-customcolum-t\",\"name\":\"ps-customcolum-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddad337a774\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-aggregation-t\",\"name\":\"ps-aggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddb7d30c57d\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-group-t\",\"name\":\"ps-group-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddd2f00c7aa\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-groupaggregation-t\",\"name\":\"ps-groupaggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dde4850e487\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport10\",\"name\":\"TestExport10\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650dd9b8ab46b\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation\",\"name\":\"TestExportDatasetAggregation\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650e17ad92f21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t02\",\"name\":\"ps-exportall-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d651104357293e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t03\",\"name\":\"ps-exportall-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65110a073dc56\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9yfan\",\"name\":\"export-u9yfan\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b1674994fd\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9sfcn\",\"name\":\"export-u9sfcn\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16952d046\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-cf6scg\",\"name\":\"export-cf6scg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16a169690\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}]}" + } + }, + "Get-AzCostManagementExport+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "764cecf8-d98d-4ec0-97f6-26f2ed2bebb2" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "0ed6173b-7d65-4e2d-a50b-c68b9d5c6b8a" ], + "x-ms-request-id": [ "6a46d3c5-3839-43e3-a42e-309883d8ea6b" ], + "x-ms-correlation-request-id": [ "b10cd0f3-c0b3-4d83-aed6-0af45e8b9961" ], + "x-ms-client-request-id": [ "764cecf8-d98d-4ec0-97f6-26f2ed2bebb2" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091503Z:b10cd0f3-c0b3-4d83-aed6-0af45e8b9961" ], + "Date": [ "Mon, 06 Jul 2020 09:15:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Get-AzCostManagementExport+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "84680f60-2b7d-411b-aae4-9259983e57a8" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "7ac3047f-40ca-4cd3-9cdc-6ffc61f15623" ], + "x-ms-request-id": [ "b3158243-14b4-4ad5-bd11-4f2f015e5859" ], + "x-ms-correlation-request-id": [ "c279ea92-0d72-4f55-af84-7ac1393d4c92" ], + "x-ms-client-request-id": [ "84680f60-2b7d-411b-aae4-9259983e57a8" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091504Z:c279ea92-0d72-4f55-af84-7ac1393d4c92" ], + "Date": [ "Mon, 06 Jul 2020 09:15:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Get-AzCostManagementExport+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "c9dc70b6-2123-4d49-ad74-65c31c6cfd5d" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "14e26877-5709-4eb2-a05e-96ae71a99999" ], + "x-ms-request-id": [ "dc595b73-e14b-453b-b549-6d9a27d3e103" ], + "x-ms-correlation-request-id": [ "f3b4f70c-c7c4-4fa2-b30d-63347d4aa542" ], + "x-ms-client-request-id": [ "c9dc70b6-2123-4d49-ad74-65c31c6cfd5d" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091505Z:f3b4f70c-c7c4-4fa2-b30d-63347d4aa542" ], + "Date": [ "Mon, 06 Jul 2020 09:15:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + } +} \ No newline at end of file diff --git a/src/CostManagement/test/Get-AzCostManagementExport.Tests.ps1 b/src/CostManagement/test/Get-AzCostManagementExport.Tests.ps1 new file mode 100644 index 000000000000..2940b9cb4076 --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExport.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzCostManagementExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzCostManagementExport' { + It 'List' { + $exportList = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" + $exportList.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $export.Name | Should -Be $env.exportName01 + } + + It 'GetViaIdentity' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $export = Get-AzCostManagementExport -InputObject $export + $export.Name | Should -Be $env.exportName01 + } +} diff --git a/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Recording.json b/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Recording.json new file mode 100644 index 000000000000..ce6954d8300c --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Recording.json @@ -0,0 +1,125 @@ +{ + "Get-AzCostManagementExportExecutionHistory+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "2a0a5bf2-9b76-420d-a8ea-9d9699448e89" ], + "CommandName": [ "Get-AzCostManagementExportExecutionHistory" ], + "FullCommandName": [ "Get-AzCostManagementExportExecutionHistory_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "f6325027-63a8-44da-bac4-eb3b1fc4edaa" ], + "x-ms-request-id": [ "e93206c3-a347-431f-baf8-a4322f8f77c4" ], + "x-ms-correlation-request-id": [ "b98e6547-5487-444d-9ffb-f603326e2313" ], + "x-ms-client-request-id": [ "2a0a5bf2-9b76-420d-a8ea-9d9699448e89" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091524Z:b98e6547-5487-444d-9ffb-f603326e2313" ], + "Date": [ "Mon, 06 Jul 2020 09:15:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "934" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/359a6e8b-abcf-45e3-aecf-b9ff3d4fc760\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:13:09.3467006Z\",\"processingStartTime\":\"2020-07-06T09:13:11.7355631Z\",\"processingEndTime\":\"2020-07-06T09:14:13.9746936Z\",\"fileName\":\"ad-hoc/export-38we0i/20200701-20200731/export-38we0i_359a6e8b-abcf-45e3-aecf-b9ff3d4fc760.csv\"}}]}" + } + }, + "Get-AzCostManagementExportExecutionHistory+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "d22920aa-bfa5-4531-b17e-7e6005a2fb7a" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "0709d528-7606-42af-b2d3-b17281e8b216" ], + "x-ms-request-id": [ "8c702ba6-09bc-4620-b7e0-1a602ef61a00" ], + "x-ms-correlation-request-id": [ "a37c5acd-2082-43e9-bd8c-e0dadb5dd53f" ], + "x-ms-client-request-id": [ "d22920aa-bfa5-4531-b17e-7e6005a2fb7a" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091526Z:a37c5acd-2082-43e9-bd8c-e0dadb5dd53f" ], + "Date": [ "Mon, 06 Jul 2020 09:15:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Get-AzCostManagementExportExecutionHistory+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "8e58532d-a286-4a8c-a0b1-b0d4c2f71b9b" ], + "CommandName": [ "Get-AzCostManagementExportExecutionHistory" ], + "FullCommandName": [ "Get-AzCostManagementExportExecutionHistory_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "cb1ec8fb-ecd1-413a-b855-dcb25d7e919c" ], + "x-ms-request-id": [ "2d05bda6-0934-4177-9254-6ea7b56d8b7d" ], + "x-ms-correlation-request-id": [ "47e339ab-943c-4c5a-ac20-f3c20e8cf4d0" ], + "x-ms-client-request-id": [ "8e58532d-a286-4a8c-a0b1-b0d4c2f71b9b" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091527Z:47e339ab-943c-4c5a-ac20-f3c20e8cf4d0" ], + "Date": [ "Mon, 06 Jul 2020 09:15:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "934" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/359a6e8b-abcf-45e3-aecf-b9ff3d4fc760\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:13:09.3467006Z\",\"processingStartTime\":\"2020-07-06T09:13:11.7355631Z\",\"processingEndTime\":\"2020-07-06T09:14:13.9746936Z\",\"fileName\":\"ad-hoc/export-38we0i/20200701-20200731/export-38we0i_359a6e8b-abcf-45e3-aecf-b9ff3d4fc760.csv\"}}]}" + } + } +} \ No newline at end of file diff --git a/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Tests.ps1 b/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Tests.ps1 new file mode 100644 index 000000000000..097cf9606605 --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Tests.ps1 @@ -0,0 +1,25 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzCostManagementExportExecutionHistory.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzCostManagementExportExecutionHistory' { + It 'Get' { + $exportHist = Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/$($env.SubscriptionId)" -ExportName $env.exportName01 + $exportHist.Count | Should -Be 1 + } + + It 'GetViaIdentity' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $exportHist = Get-AzCostManagementExportExecutionHistory -InputObject $export + $exportHist.Count | Should -Be 1 + } +} diff --git a/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json new file mode 100644 index 000000000000..68ea94ef94e2 --- /dev/null +++ b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json @@ -0,0 +1,205 @@ +{ + "Invoke-AzCostManagementExecuteExport+[NoContext]+Execute+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/run?api-version=2019-11-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/run?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "aa5de09b-ef0e-4ea4-b4ee-f3c17259b778" ], + "CommandName": [ "Invoke-AzCostManagementExecuteExport" ], + "FullCommandName": [ "Invoke-AzCostManagementExecuteExport_Execute" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "c5cfdf23-b5cf-4d5e-a72d-be4d96d9d4c7" ], + "x-ms-request-id": [ "415a06e2-5e88-4a14-a1ea-d6e42a98ea53" ], + "x-ms-correlation-request-id": [ "3f12b48f-92bd-4e6b-9787-1115afe8a6a7" ], + "x-ms-client-request-id": [ "aa5de09b-ef0e-4ea4-b4ee-f3c17259b778" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091735Z:3f12b48f-92bd-4e6b-9787-1115afe8a6a7" ], + "Date": [ "Mon, 06 Jul 2020 09:17:35 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Invoke-AzCostManagementExecuteExport+[NoContext]+Execute+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "59339ec2-05bd-469f-b15c-252dc532c76a" ], + "CommandName": [ "Get-AzCostManagementExportExecutionHistory" ], + "FullCommandName": [ "Get-AzCostManagementExportExecutionHistory_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "91923384-1eb0-49df-a7ac-0eedc372ae04" ], + "x-ms-request-id": [ "a95ba8c3-de6c-4f2e-87cf-9daab33d7ebb" ], + "x-ms-correlation-request-id": [ "8a6cbf6e-b118-4c5f-8277-4814220a0163" ], + "x-ms-client-request-id": [ "59339ec2-05bd-469f-b15c-252dc532c76a" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091736Z:8a6cbf6e-b118-4c5f-8277-4814220a0163" ], + "Date": [ "Mon, 06 Jul 2020 09:17:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1715" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/359a6e8b-abcf-45e3-aecf-b9ff3d4fc760\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:13:09.3467006Z\",\"processingStartTime\":\"2020-07-06T09:13:11.7355631Z\",\"processingEndTime\":\"2020-07-06T09:14:13.9746936Z\",\"fileName\":\"ad-hoc/export-38we0i/20200701-20200731/export-38we0i_359a6e8b-abcf-45e3-aecf-b9ff3d4fc760.csv\"}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/05d2edf7-74a0-4bf4-a28a-992fd9c7655e\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:17:34.6964397Z\",\"processingStartTime\":null,\"processingEndTime\":null,\"fileName\":null}}]}" + } + }, + "Invoke-AzCostManagementExecuteExport+[NoContext]+ExecuteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "d16ab7f1-1909-405c-b707-370048ec9171" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "97c945bd-2cc2-4707-96a4-86f5060f106b" ], + "x-ms-request-id": [ "4d27ae1c-d61a-453a-973b-8563c9a1bb54" ], + "x-ms-correlation-request-id": [ "a8f035cc-80ea-4935-8fe0-dbe58b44c180" ], + "x-ms-client-request-id": [ "d16ab7f1-1909-405c-b707-370048ec9171" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091737Z:a8f035cc-80ea-4935-8fe0-dbe58b44c180" ], + "Date": [ "Mon, 06 Jul 2020 09:17:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Invoke-AzCostManagementExecuteExport+[NoContext]+ExecuteViaIdentity+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/run?api-version=2019-11-01+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/run?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "b98b569c-e163-4298-9790-6356cde0b285" ], + "CommandName": [ "Invoke-AzCostManagementExecuteExport" ], + "FullCommandName": [ "Invoke-AzCostManagementExecuteExport_ExecuteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "18205cc1-ff38-4a95-9aef-c16dbbfc4988" ], + "x-ms-request-id": [ "35db35b8-a307-4e71-9ffe-5bf8301d5b8f" ], + "x-ms-correlation-request-id": [ "95da9561-b928-474a-bfd2-02a4996862b3" ], + "x-ms-client-request-id": [ "b98b569c-e163-4298-9790-6356cde0b285" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091738Z:95da9561-b928-474a-bfd2-02a4996862b3" ], + "Date": [ "Mon, 06 Jul 2020 09:17:38 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Invoke-AzCostManagementExecuteExport+[NoContext]+ExecuteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/runHistory?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "f221456a-8398-45e0-a566-0ef1543db998" ], + "CommandName": [ "Get-AzCostManagementExportExecutionHistory" ], + "FullCommandName": [ "Get-AzCostManagementExportExecutionHistory_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "a547d712-70dd-4121-8ffa-d39c2a97b2c6" ], + "x-ms-request-id": [ "0c86b83d-3d5c-412b-a5e1-6c5f51052e32" ], + "x-ms-correlation-request-id": [ "7bd97d1f-b0fe-4fba-95bf-bd1adfa3c10e" ], + "x-ms-client-request-id": [ "f221456a-8398-45e0-a566-0ef1543db998" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T091739Z:7bd97d1f-b0fe-4fba-95bf-bd1adfa3c10e" ], + "Date": [ "Mon, 06 Jul 2020 09:17:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2495" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/359a6e8b-abcf-45e3-aecf-b9ff3d4fc760\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:13:09.3467006Z\",\"processingStartTime\":\"2020-07-06T09:13:11.7355631Z\",\"processingEndTime\":\"2020-07-06T09:14:13.9746936Z\",\"fileName\":\"ad-hoc/export-38we0i/20200701-20200731/export-38we0i_359a6e8b-abcf-45e3-aecf-b9ff3d4fc760.csv\"}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/05d2edf7-74a0-4bf4-a28a-992fd9c7655e\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:17:34.6964397Z\",\"processingStartTime\":null,\"processingEndTime\":null,\"fileName\":null}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i/Run/93ffc801-3f72-4485-9dd7-a39dfa22d130\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-diya@microsoft.com\",\"submittedTime\":\"2020-07-06T09:17:38.009024Z\",\"processingStartTime\":null,\"processingEndTime\":null,\"fileName\":null}}]}" + } + } +} \ No newline at end of file diff --git a/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Tests.ps1 b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Tests.ps1 new file mode 100644 index 000000000000..8dac196657d4 --- /dev/null +++ b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Tests.ps1 @@ -0,0 +1,27 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzCostManagementExecuteExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Invoke-AzCostManagementExecuteExport' { + It 'Execute' { + Invoke-AzCostManagementExecuteExport -Scope "subscriptions/$($env.SubscriptionId)" -ExportName $env.exportName01 + $exportHist = Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/$($env.SubscriptionId)" -ExportName $env.exportName01 + $exportHist.Count | Should -Be 2 + } + + It 'ExecuteViaIdentity' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + Invoke-AzCostManagementExecuteExport -InputObject $export + $exportHist = Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/$($env.SubscriptionId)" -ExportName $env.exportName01 + $exportHist.Count | Should -Be 3 + } +} diff --git a/src/CostManagement/test/Invoke-AzCostManagementUsageQuery.Tests.ps1 b/src/CostManagement/test/Invoke-AzCostManagementUsageQuery.Tests.ps1 new file mode 100644 index 000000000000..ff8cb625bb70 --- /dev/null +++ b/src/CostManagement/test/Invoke-AzCostManagementUsageQuery.Tests.ps1 @@ -0,0 +1,20 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzCostManagementUsageQuery.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Invoke-AzCostManagementUsageQuery' { + It 'UsageExpanded' -Skip { + # The record file not generated, Because using Invoke-AzRest when call Invoke-AzCostManagementUsageQuery. + # TODO: When Invoke-AzRest support record model. + { Invoke-AzCostManagementUsageQuery -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'daily' } | Should -Not -Throw + } +} diff --git a/src/CostManagement/test/New-AzCostManagementExport.Recording.json b/src/CostManagement/test/New-AzCostManagementExport.Recording.json new file mode 100644 index 000000000000..72dac9c415b5 --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementExport.Recording.json @@ -0,0 +1,187 @@ +{ + "New-AzCostManagementExport+[NoContext]+CreateExpandedBySubscription+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol?api-version=2019-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol?api-version=2019-11-01", + "Content": "{\n \"properties\": {\n \"definition\": {\n \"dataset\": {\n \"granularity\": \"Daily\"\n },\n \"type\": \"Usage\",\n \"timeframe\": \"MonthToDate\"\n },\n \"deliveryInfo\": {\n \"destination\": {\n \"container\": \"exports\",\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\n \"rootFolderPath\": \"ad-hoc\"\n }\n },\n \"format\": \"Csv\",\n \"schedule\": {\n \"recurrencePeriod\": {\n \"from\": \"2020-07-06T09:13:02.0000000\",\n \"to\": \"2020-07-26T09:13:02.0000000\"\n },\n \"recurrence\": \"Daily\",\n \"status\": \"Active\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "700" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://consumption.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol?api-version=2019-11-01" ], + "session-id": [ "361a8dc7-600f-48f9-b480-814e2805b158" ], + "x-ms-request-id": [ "9b7c7f17-026c-4665-9b68-c7351118fabf" ], + "x-ms-correlation-request-id": [ "940aeece-adb9-45a5-b838-c40fbf9395fd" ], + "x-ms-client-request-id": [ "82d6e05b-9aeb-4b1e-a93d-dcad8420be2d" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11980" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092243Z:940aeece-adb9-45a5-b838-c40fbf9395fd" ], + "Date": [ "Mon, 06 Jul 2020 09:22:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "709" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol\",\"name\":\"export-r6xjol\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377005b37c6\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "New-AzCostManagementExport+[NoContext]+CreateExpandedByResourceGroup+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01", + "Content": "{\n \"properties\": {\n \"definition\": {\n \"dataset\": {\n \"granularity\": \"Daily\"\n },\n \"type\": \"Usage\",\n \"timeframe\": \"MonthToDate\"\n },\n \"deliveryInfo\": {\n \"destination\": {\n \"container\": \"exports\",\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\n \"rootFolderPath\": \"ad-hoc\"\n }\n },\n \"format\": \"Csv\",\n \"schedule\": {\n \"recurrencePeriod\": {\n \"from\": \"2020-07-06T09:13:02.0000000\",\n \"to\": \"2020-07-26T09:13:02.0000000\"\n },\n \"recurrence\": \"Daily\",\n \"status\": \"Active\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "700" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://consumption.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01" ], + "session-id": [ "5b9bb6b5-cc5f-49fc-9af1-aef16afed5ec" ], + "x-ms-request-id": [ "91135221-6de8-4fbe-b4f0-7b0d6c122e40" ], + "x-ms-correlation-request-id": [ "4f2fc077-2b2f-4705-88a4-ee1329c3ea32" ], + "x-ms-client-request-id": [ "8e5a1cc5-b5af-426f-a6d6-d0bd1fd02884" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11979" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092244Z:4f2fc077-2b2f-4705-88a4-ee1329c3ea32" ], + "Date": [ "Mon, 06 Jul 2020 09:22:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "749" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5\",\"name\":\"export-rs3qh5\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377017c569f\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "New-AzCostManagementExport+[NoContext]+CreateExpandedByColumn+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2?api-version=2019-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2?api-version=2019-11-01", + "Content": "{\n \"properties\": {\n \"definition\": {\n \"dataset\": {\n \"configuration\": {\n \"columns\": [ \"SubscriptionGuid\", \"MeterId\", \"InstanceId\", \"ResourceGroup\", \"PreTaxCost\" ]\n },\n \"granularity\": \"Daily\"\n },\n \"type\": \"Usage\",\n \"timeframe\": \"MonthToDate\"\n },\n \"deliveryInfo\": {\n \"destination\": {\n \"container\": \"exports\",\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\n \"rootFolderPath\": \"ad-hoc\"\n }\n },\n \"format\": \"Csv\",\n \"schedule\": {\n \"recurrencePeriod\": {\n \"from\": \"2020-07-06T09:13:02.0000000\",\n \"to\": \"2020-07-26T09:13:02.0000000\"\n },\n \"recurrence\": \"Daily\",\n \"status\": \"Active\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "838" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://consumption.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2?api-version=2019-11-01" ], + "session-id": [ "c0a0fcfb-517c-40b0-abfd-74a6fd6f5350" ], + "x-ms-request-id": [ "960a8d4b-ac23-4895-959a-b2c77f6fd30f" ], + "x-ms-correlation-request-id": [ "cdd904bf-1506-42f0-a6e7-f373594a55f9" ], + "x-ms-client-request-id": [ "95a913d0-9eb2-44b7-a4fc-bfb725432239" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11978" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092246Z:cdd904bf-1506-42f0-a6e7-f373594a55f9" ], + "Date": [ "Mon, 06 Jul 2020 09:22:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "810" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2\",\"name\":\"export-ni0ar2\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6537702554d6a\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}}" + } + }, + "New-AzCostManagementExport+[NoContext]+CreateExpandedByGroup+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft?api-version=2019-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft?api-version=2019-11-01", + "Content": "{\n \"properties\": {\n \"definition\": {\n \"dataset\": {\n \"granularity\": \"Daily\",\n \"grouping\": [\n {\n \"name\": \"ResourceGroup\",\n \"type\": \"Dimension\"\n }\n ]\n },\n \"type\": \"Usage\",\n \"timeframe\": \"MonthToDate\"\n },\n \"deliveryInfo\": {\n \"destination\": {\n \"container\": \"exports\",\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\n \"rootFolderPath\": \"ad-hoc\"\n }\n },\n \"format\": \"Csv\",\n \"schedule\": {\n \"recurrencePeriod\": {\n \"from\": \"2020-07-06T09:13:02.0000000\",\n \"to\": \"2020-07-26T09:13:02.0000000\"\n },\n \"recurrence\": \"Daily\",\n \"status\": \"Active\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "826" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://consumption.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft?api-version=2019-11-01" ], + "session-id": [ "bbebf88b-bfaf-4862-9452-ac4c1d301006" ], + "x-ms-request-id": [ "605da652-113d-459e-9b0a-844f85d8e68f" ], + "x-ms-correlation-request-id": [ "655498cc-40ac-4af0-b979-37f07a1d8009" ], + "x-ms-client-request-id": [ "609dabb6-22f5-432c-8116-44ceff4f8782" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11977" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092248Z:655498cc-40ac-4af0-b979-37f07a1d8009" ], + "Date": [ "Mon, 06 Jul 2020 09:22:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "766" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft\",\"name\":\"export-gq1kft\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6537703972b88\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}}" + } + }, + "New-AzCostManagementExport+[NoContext]+CreateExpandedByGroupAggregation+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of?api-version=2019-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of?api-version=2019-11-01", + "Content": "{\n \"properties\": {\n \"definition\": {\n \"dataset\": {\n \"aggregation\": {\n \"costsum\": {\n \"name\": \"PreTaxCost\",\n \"function\": \"sum\"\n },\n \"cost\": {\n \"name\": \"Cost\",\n \"function\": \"sum\"\n }\n },\n \"granularity\": \"Daily\",\n \"grouping\": [\n {\n \"name\": \"ResourceGroup\",\n \"type\": \"Dimension\"\n }\n ]\n },\n \"type\": \"Usage\",\n \"timeframe\": \"MonthToDate\"\n },\n \"deliveryInfo\": {\n \"destination\": {\n \"container\": \"exports\",\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\n \"rootFolderPath\": \"ad-hoc\"\n }\n },\n \"format\": \"Csv\",\n \"schedule\": {\n \"recurrencePeriod\": {\n \"from\": \"2020-07-06T09:13:02.0000000\",\n \"to\": \"2020-07-26T09:13:02.0000000\"\n },\n \"recurrence\": \"Daily\",\n \"status\": \"Active\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1052" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://consumption.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of?api-version=2019-11-01" ], + "session-id": [ "f4257420-e658-4922-8a45-5070a7a873f9" ], + "x-ms-request-id": [ "bcbee889-01b3-4622-9367-79d39cc4209e" ], + "x-ms-correlation-request-id": [ "c33b1ea7-0200-4131-ba5e-ce80b54e9f22" ], + "x-ms-client-request-id": [ "61711854-579b-4158-ac78-77280128fe03" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11976" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092249Z:c33b1ea7-0200-4131-ba5e-ce80b54e9f22" ], + "Date": [ "Mon, 06 Jul 2020 09:22:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "871" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of\",\"name\":\"export-j8s5of\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377046dbf7c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}}" + } + } +} \ No newline at end of file diff --git a/src/CostManagement/test/New-AzCostManagementExport.Tests.ps1 b/src/CostManagement/test/New-AzCostManagementExport.Tests.ps1 new file mode 100644 index 000000000000..767e806850c8 --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementExport.Tests.ps1 @@ -0,0 +1,103 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzCostManagementExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzCostManagementExport' { + It 'CreateExpandedBySubscription' { + # Create export cost management by subscription + $export = New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName02 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom $env.fromDate ` + -RecurrencePeriodTo $env.toDate -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" + + $export.ScheduleStatus | Should -Be 'Active' + } + It 'CreateExpandedByResourceGroup' { + # Create export cost management by resource group + $export = New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)" -Name $env.exportName03 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom $env.fromDate ` + -RecurrencePeriodTo $env.toDate -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" + + $export.ScheduleStatus | Should -Be 'Active' + } + It 'CreateExpandedByColumn' { + $export = New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName04 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom $env.fromDate ` + -RecurrencePeriodTo $env.toDate -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" ` + -ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') + + $export.ScheduleStatus | Should -Be 'Active' + } + + It 'CreateExpandedByGroup' { + $export = New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName05 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom $env.fromDate ` + -RecurrencePeriodTo $env.toDate -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" ` + -DatasetGrouping @(@{type='Dimension'; name='ResourceGroup'}) + + $export.ScheduleStatus | Should -Be 'Active' + } + It 'CreateExpandedByGroupAggregation' { + #Group Aggregation: Created successfully, No data generated in the storage account + $Aggregation1 = @{ name = 'PreTaxCost'; function='sum'} + $Aggregation2 = @{ name = 'Cost'; function='sum'} + $AggregationDict = @{costsum=$aggregation1; cost=$aggregation2} + + $export = New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName06 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom $env.fromDate ` + -RecurrencePeriodTo $env.toDate -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" ` + -DatasetGrouping @(@{type='Dimension'; name='ResourceGroup'}) ` + -DatasetAggregation $AggregationDict + + $export.ScheduleStatus | Should -Be 'Active' + } + + It 'CreateExpandedByFilter' -skip { + #Filter: Create failed, Invalid dataset filter; on a QueryFilter one and only one of and/or/not/dimension/tag can be set. Invalid dataset + # filter; on a QueryFilter one and only one of and/or/not/dimension/tag can be set. + #TODO: The issue fix. + <# + $orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') + $queryOrDimension = New-AzCostManagementQueryFilterObject -Dimension $orDimension + $orTag = New-AzCostManagementQueryComparisonExpressionObject -Name 'Environment' -Operator In -Value @('UAT', 'Prod') + $queryOrTag = New-AzCostManagementQueryFilterObject -Tag $orTag + $andOr = New-AzCostManagementQueryFilterObject -or @((New-AzCostManagementQueryFilterObject -Dimension $orDimension), (New-AzCostManagementQueryFilterObject -Tag $orTag)) + + $dimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceGroup' -Operator In -Value 'API' + $andDimension = New-AzCostManagementQueryFilterObject -Dimension $dimension + $fileter = New-AzCostManagementQueryFilterObject -And @($andOr, $andDimension) + + New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-filter-t01" ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" ` + -RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` + -DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` + -DatasetGranularity "Daily" ` + -DatasetFilter $fileter + #> + } + +} diff --git a/src/CostManagement/test/New-AzCostManagementQueryColumnObject.Tests.ps1 b/src/CostManagement/test/New-AzCostManagementQueryColumnObject.Tests.ps1 new file mode 100644 index 000000000000..35a70dd55a82 --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementQueryColumnObject.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzCostManagementQueryColumnObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzCostManagementQueryColumnObject' { + It '__AllParameterSets' { + { New-AzCostManagementQueryColumnObject -Name 'SubscriptionGuid' -Type 'string' } | Should -Not -Throw + } +} diff --git a/src/CostManagement/test/New-AzCostManagementQueryComparisonExpressionObject.Tests.ps1 b/src/CostManagement/test/New-AzCostManagementQueryComparisonExpressionObject.Tests.ps1 new file mode 100644 index 000000000000..7cf80493cdc4 --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementQueryComparisonExpressionObject.Tests.ps1 @@ -0,0 +1,20 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzCostManagementQueryComparisonExpressionObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzCostManagementQueryComparisonExpressionObject' { + It '__AllParameterSets' { + { + $orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') + } | Should -Not -Throw + } +} diff --git a/src/CostManagement/test/New-AzCostManagementQueryFilterObject.Tests.ps1 b/src/CostManagement/test/New-AzCostManagementQueryFilterObject.Tests.ps1 new file mode 100644 index 000000000000..2e490b60f25b --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementQueryFilterObject.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzCostManagementQueryFilterObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzCostManagementQueryFilterObject' { + It '__AllParameterSets' { + { + $orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') + $orTag = New-AzCostManagementQueryComparisonExpressionObject -Name 'Environment' -Operator In -Value @('UAT', 'Prod') + $andOr = New-AzCostManagementQueryFilterObject -or @((New-AzCostManagementQueryFilterObject -Dimension $orDimension), (New-AzCostManagementQueryFilterObject -Tag $orTag)) + + $dimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceGroup' -Operator In -Value 'API' + $andDimension = New-AzCostManagementQueryFilterObject -Dimension $dimension + $fileter = New-AzCostManagementQueryFilterObject -And @($andOr, $andDimension) + } | Should -Not -Throw + } +} diff --git a/src/CostManagement/test/Remove-AzCostManagementExport.Recording.json b/src/CostManagement/test/Remove-AzCostManagementExport.Recording.json new file mode 100644 index 000000000000..76df2901aa3e --- /dev/null +++ b/src/CostManagement/test/Remove-AzCostManagementExport.Recording.json @@ -0,0 +1,205 @@ +{ + "Remove-AzCostManagementExport+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2?api-version=2019-11-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-ni0ar2?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "535649f7-37d1-411b-9b2f-dcbf463cfdbb" ], + "CommandName": [ "Remove-AzCostManagementExport" ], + "FullCommandName": [ "Remove-AzCostManagementExport_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "f9232219-c998-4ac6-bcf9-e01d0a7305cf" ], + "x-ms-request-id": [ "449a95a0-8a08-4a14-9f3f-22b448eac6d1" ], + "x-ms-correlation-request-id": [ "6013e0f6-10b6-4e53-8f27-7239a2a1e8ef" ], + "x-ms-client-request-id": [ "535649f7-37d1-411b-9b2f-dcbf463cfdbb" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092523Z:6013e0f6-10b6-4e53-8f27-7239a2a1e8ef" ], + "Date": [ "Mon, 06 Jul 2020 09:25:22 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzCostManagementExport+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "739c6edc-d378-45e9-8acd-1b1ddac54c8e" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "c675f856-4636-483c-8aaa-768eea00264d" ], + "x-ms-request-id": [ "ce4d168e-38f6-4461-9cd6-edbe683ad303" ], + "x-ms-correlation-request-id": [ "fe419d55-604d-43b3-b298-c88e63feee47" ], + "x-ms-client-request-id": [ "739c6edc-d378-45e9-8acd-1b1ddac54c8e" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092524Z:fe419d55-604d-43b3-b298-c88e63feee47" ], + "Date": [ "Mon, 06 Jul 2020 09:25:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "26269" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport\",\"name\":\"TestExport\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb46c1f5154\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T00:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport1\",\"name\":\"TestExport1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb4a3f75019\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T20:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport2\",\"name\":\"TestExport2\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f5dda56551\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport3\",\"name\":\"TestExport3\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6069c44bb\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport4\",\"name\":\"TestExport4\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6425d3647\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport5\",\"name\":\"TestExport5\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f679d78775\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport6\",\"name\":\"TestExport6\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6b27ba29f\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T02\",\"name\":\"LucasExport-T02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f8ec7b1149\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T03\",\"name\":\"LucasExport-T03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f918708873\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExportT06\",\"name\":\"LucasExportT06\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f9d2f5df21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-27T20:00:00+00:00\",\"to\":\"2020-06-28T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t01\",\"name\":\"ps-costext-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649ff52ae2bb7\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-24T00:00:00+00:00\",\"to\":\"2020-06-26T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t02\",\"name\":\"ps-costext-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d16faa5d7b4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T00:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t03\",\"name\":\"ps-costext-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1be92e19a4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:45:28\",\"to\":\"2020-07-18T07:15:28\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportws5qlv\",\"name\":\"exportws5qlv\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1d1164c9ac\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:53:46\",\"to\":\"2020-07-18T07:23:46\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmkjhje\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t01\",\"name\":\"manual-export-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd725acbcdf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T20:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t02\",\"name\":\"manual-export-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd8071bf283\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportinfo-ps-t\",\"name\":\"exportinfo-ps-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda275a663c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t\",\"name\":\"ps-exportall-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda37395609\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-customcolum-t\",\"name\":\"ps-customcolum-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddad337a774\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-aggregation-t\",\"name\":\"ps-aggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddb7d30c57d\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-group-t\",\"name\":\"ps-group-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddd2f00c7aa\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-groupaggregation-t\",\"name\":\"ps-groupaggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dde4850e487\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport10\",\"name\":\"TestExport10\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650dd9b8ab46b\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation\",\"name\":\"TestExportDatasetAggregation\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650e17ad92f21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t02\",\"name\":\"ps-exportall-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d651104357293e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t03\",\"name\":\"ps-exportall-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65110a073dc56\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9yfan\",\"name\":\"export-u9yfan\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b1674994fd\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9sfcn\",\"name\":\"export-u9sfcn\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16952d046\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-cf6scg\",\"name\":\"export-cf6scg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16a169690\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol\",\"name\":\"export-r6xjol\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377005b37c6\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft\",\"name\":\"export-gq1kft\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6537703972b88\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of\",\"name\":\"export-j8s5of\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377046dbf7c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}}]}" + } + }, + "Remove-AzCostManagementExport+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "6684dacb-2030-4120-b7ad-a486167d3886" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "921183df-cf9f-4104-92ee-3700f5e8aaed" ], + "x-ms-request-id": [ "4a734a96-b3e1-4b92-92e1-578039584923" ], + "x-ms-correlation-request-id": [ "01e6de87-94af-4c75-a3b9-385c9e3cf165" ], + "x-ms-client-request-id": [ "6684dacb-2030-4120-b7ad-a486167d3886" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11987" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092524Z:01e6de87-94af-4c75-a3b9-385c9e3cf165" ], + "Date": [ "Mon, 06 Jul 2020 09:25:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "749" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5\",\"name\":\"export-rs3qh5\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377017c569f\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Remove-AzCostManagementExport+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.CostManagement/exports/export-rs3qh5?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "8f26b1f2-b17c-4913-9c9f-b47b54502d30" ], + "CommandName": [ "Remove-AzCostManagementExport" ], + "FullCommandName": [ "Remove-AzCostManagementExport_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "a75be8a6-2f8d-4b2e-b75e-29756e8e9e85" ], + "x-ms-request-id": [ "007defc8-ccf3-448e-b9f3-e3bb81ee6669" ], + "x-ms-correlation-request-id": [ "58d53028-e64b-4974-8365-dafd4fb3e6a0" ], + "x-ms-client-request-id": [ "8f26b1f2-b17c-4913-9c9f-b47b54502d30" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11986" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092525Z:58d53028-e64b-4974-8365-dafd4fb3e6a0" ], + "Date": [ "Mon, 06 Jul 2020 09:25:25 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzCostManagementExport+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2019-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "c3d09aa8-5731-4964-b862-f658e5146650" ], + "CommandName": [ "Get-AzCostManagementExport" ], + "FullCommandName": [ "Get-AzCostManagementExport_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "session-id": [ "dff4aa38-f47b-4de1-80db-0ead27b421e9" ], + "x-ms-request-id": [ "e4d4e2ab-31c3-4367-bef5-05faaf81dc4a" ], + "x-ms-correlation-request-id": [ "d964c677-9edf-44a7-a2fd-e1857cd728f7" ], + "x-ms-client-request-id": [ "c3d09aa8-5731-4964-b862-f658e5146650" ], + "Access-Control-Allow-Origin": [ "*" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11985" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200706T092526Z:d964c677-9edf-44a7-a2fd-e1857cd728f7" ], + "Date": [ "Mon, 06 Jul 2020 09:25:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "26269" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport\",\"name\":\"TestExport\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb46c1f5154\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T00:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport1\",\"name\":\"TestExport1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d63fb4a3f75019\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-11T20:00:00+00:00\",\"to\":\"2020-06-20T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport2\",\"name\":\"TestExport2\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f5dda56551\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport3\",\"name\":\"TestExport3\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6069c44bb\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport4\",\"name\":\"TestExport4\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6425d3647\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport5\",\"name\":\"TestExport5\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f679d78775\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\"}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport6\",\"name\":\"TestExport6\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f6b27ba29f\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T02\",\"name\":\"LucasExport-T02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f8ec7b1149\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExport-T03\",\"name\":\"LucasExport-T03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f918708873\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-25T20:00:00+00:00\",\"to\":\"2020-06-29T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/LucasExportT06\",\"name\":\"LucasExportT06\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649f9d2f5df21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-27T20:00:00+00:00\",\"to\":\"2020-06-28T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t01\",\"name\":\"ps-costext-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d649ff52ae2bb7\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-24T00:00:00+00:00\",\"to\":\"2020-06-26T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t02\",\"name\":\"ps-costext-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d16faa5d7b4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T00:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-costext-t03\",\"name\":\"ps-costext-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1be92e19a4\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:45:28\",\"to\":\"2020-07-18T07:15:28\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/azureps-manual-test/providers/Microsoft.Storage/storageAccounts/lucascostmanagement\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportws5qlv\",\"name\":\"exportws5qlv\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64d1d1164c9ac\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-28T07:53:46\",\"to\":\"2020-07-18T07:23:46\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmkjhje\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t01\",\"name\":\"manual-export-t01\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd725acbcdf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T20:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/manual-export-t02\",\"name\":\"manual-export-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dd8071bf283\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/exportinfo-ps-t\",\"name\":\"exportinfo-ps-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda275a663c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t\",\"name\":\"ps-exportall-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dda37395609\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-customcolum-t\",\"name\":\"ps-customcolum-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddad337a774\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-aggregation-t\",\"name\":\"ps-aggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddb7d30c57d\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-group-t\",\"name\":\"ps-group-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64ddd2f00c7aa\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-groupaggregation-t\",\"name\":\"ps-groupaggregation-t\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d64dde4850e487\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-06-29T13:00:00+00:00\",\"to\":\"2020-07-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"},\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport10\",\"name\":\"TestExport10\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650dd9b8ab46b\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation\",\"name\":\"TestExportDatasetAggregation\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d650e17ad92f21\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T20:00:00+00:00\",\"to\":\"2020-07-10T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}}}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t02\",\"name\":\"ps-exportall-t02\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d651104357293e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/ps-exportall-t03\",\"name\":\"ps-exportall-t03\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65110a073dc56\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-03T08:00:00+00:00\",\"to\":\"2020-08-01T00:00:00+00:00\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9yfan\",\"name\":\"export-u9yfan\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b1674994fd\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-u9sfcn\",\"name\":\"export-u9sfcn\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16952d046\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-cf6scg\",\"name\":\"export-cf6scg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d652b16a169690\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-05T07:41:32\",\"to\":\"2020-07-21T07:41:32\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/staaccountmhot0q\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-38we0i\",\"name\":\"export-38we0i\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65375a9692caf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-r6xjol\",\"name\":\"export-r6xjol\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377005b37c6\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-gq1kft\",\"name\":\"export-gq1kft\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6537703972b88\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-j8s5of\",\"name\":\"export-j8s5of\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d65377046dbf7c\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-07-06T09:13:02\",\"to\":\"2020-07-26T09:13:02\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\",\"aggregation\":{\"costsum\":{\"name\":\"PreTaxCost\",\"function\":\"Sum\"},\"cost\":{\"name\":\"Cost\",\"function\":\"Sum\"}},\"grouping\":[{\"type\":\"Dimension\",\"name\":\"ResourceGroup\"}]}}}}]}" + } + } +} \ No newline at end of file diff --git a/src/CostManagement/test/Remove-AzCostManagementExport.Tests.ps1 b/src/CostManagement/test/Remove-AzCostManagementExport.Tests.ps1 new file mode 100644 index 000000000000..ba82788c08a2 --- /dev/null +++ b/src/CostManagement/test/Remove-AzCostManagementExport.Tests.ps1 @@ -0,0 +1,27 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzCostManagementExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzCostManagementExport' { + It 'Delete' { + Remove-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName04 + $exportList = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" + $exportList.Name| Should -Not -Contain $env.exportName04 + } + + It 'DeleteViaIdentity' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)" -Name $env.exportName03 + Remove-AzCostManagementExport -InputObject $export + $exportList = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" + $exportList.Name| Should -Not -Contain $env.exportName03 + } +} diff --git a/src/CostManagement/test/Update-AzCostManagementExport.Tests.ps1 b/src/CostManagement/test/Update-AzCostManagementExport.Tests.ps1 new file mode 100644 index 000000000000..7014d42d40d4 --- /dev/null +++ b/src/CostManagement/test/Update-AzCostManagementExport.Tests.ps1 @@ -0,0 +1,29 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzCostManagementExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzCostManagementExport' { + It 'UpdateExpanded' -skip { + # Has issue on server, Parameter ResourceID is not null + # TODO: When fix issue on server + $export = Update-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 -RecurrencePeriodFrom $env.toDate + $export.RecurrencePeriodFrom | Should -Be $env.toDate + } + + It 'UpdateViaIdentityExpanded' -skip { + # Has issue on server, Parameter ResourceID is not null + # TODO: When fix issue on server + $oldExport = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $export = Update-AzCostManagementExport -InputObject $oldExport -RecurrencePeriodFrom $env.fromDate + $export.RecurrencePeriodFrom | Should -Be $env.fromDate + } +} diff --git a/src/CostManagement/test/deployment-templates/storage-account/parameters.json b/src/CostManagement/test/deployment-templates/storage-account/parameters.json new file mode 100644 index 000000000000..005b17d22f35 --- /dev/null +++ b/src/CostManagement/test/deployment-templates/storage-account/parameters.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccounts_name": null + } +} diff --git a/src/CostManagement/test/deployment-templates/storage-account/template.json b/src/CostManagement/test/deployment-templates/storage-account/template.json new file mode 100644 index 000000000000..1ce0851a5d9e --- /dev/null +++ b/src/CostManagement/test/deployment-templates/storage-account/template.json @@ -0,0 +1,96 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccounts_name": { + "defaultValue": "staaccountjshubiu", + "type": "String" + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-06-01", + "name": "[parameters('storageAccounts_name')]", + "location": "eastus", + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" + }, + "kind": "StorageV2", + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + }, + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "keyType": "Account", + "enabled": true + }, + "blob": { + "keyType": "Account", + "enabled": true + } + }, + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot" + } + }, + { + "type": "Microsoft.Storage/storageAccounts/blobServices", + "apiVersion": "2019-06-01", + "name": "[concat(parameters('storageAccounts_name'), '/default')]", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_name'))]" + ], + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" + }, + "properties": { + "cors": { + "corsRules": [] + }, + "deleteRetentionPolicy": { + "enabled": false + } + } + }, + { + "type": "Microsoft.Storage/storageAccounts/fileServices", + "apiVersion": "2019-06-01", + "name": "[concat(parameters('storageAccounts_name'), '/default')]", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_name'))]" + ], + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" + }, + "properties": { + "cors": { + "corsRules": [] + } + } + }, + { + "type": "Microsoft.Storage/storageAccounts/blobServices/containers", + "apiVersion": "2019-06-01", + "name": "[concat(parameters('storageAccounts_name'), '/default/exports')]", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccounts_name'), 'default')]", + "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_name'))]" + ], + "properties": { + "publicAccess": "None" + } + } + ] +} \ No newline at end of file diff --git a/src/CostManagement/test/env.json b/src/CostManagement/test/env.json new file mode 100644 index 000000000000..4e7b60c28d9d --- /dev/null +++ b/src/CostManagement/test/env.json @@ -0,0 +1,17 @@ +{ + "storageAccountId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-5rij6b/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu", + "location": "eastus", + "resourceGroup": "costmanagement-rg-5rij6b", + "exportName08": "export-93sr8e", + "exportName06": "export-j8s5of", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "exportName05": "export-gq1kft", + "fromDate": "7/6/2020 9:13:02 AM", + "exportName01": "export-38we0i", + "exportName02": "export-r6xjol", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "toDate": "7/26/2020 9:13:02 AM", + "exportName03": "export-rs3qh5", + "exportName04": "export-ni0ar2", + "exportName07": "export-ktoa73" +} diff --git a/src/CostManagement/test/loadEnv.ps1 b/src/CostManagement/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/CostManagement/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/CostManagement/test/readme.md b/src/CostManagement/test/readme.md new file mode 100644 index 000000000000..1969200c6a09 --- /dev/null +++ b/src/CostManagement/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `../custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/CostManagement/test/test-script.ps1 b/src/CostManagement/test/test-script.ps1 new file mode 100644 index 000000000000..21a919b92419 --- /dev/null +++ b/src/CostManagement/test/test-script.ps1 @@ -0,0 +1,91 @@ +<# +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "LucasTestExport" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" ` +-RecurrencePeriodFrom "2020-06-20T20:00:00Z" ` +-RecurrencePeriodTo "2020-06-24T00:00:00Z" ` +-Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" ` +-DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" ` +#-ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') +-DatasetAggregation $AggregationDict ` +-DatasetGrouping @(@{type='Dimension'; name='SubscriptionName'}; @{type='Tag'; name='Environment'}) ` +#-DatasetFilter $fileter +#> + +<# export all info pass +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-exportall-t" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" ` +-RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" +#> + +<# custom colum pass +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-customcolum-t" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" ` +-RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" ` +-ConfigurationColumn @('SubscriptionGuid', 'MeterId', 'InstanceId', 'ResourceGroup', 'PreTaxCost') +#> + +<# Aggregation: The data not generate in the storage account +$Aggregation1 = @{ name = 'PreTaxCost'; function='sum'} +$Aggregation2 = @{ name = 'Cost'; function='sum'} +$AggregationDict = @{costsum=$aggregation1; cost=$aggregation2} + +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-aggregation-t" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" ` +-RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" ` +-DatasetAggregation $AggregationDict +#> + +<#Group pass +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-group-t" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T15:00:00Z" ` +-RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" ` +-DatasetGrouping @(@{type='Dimension'; name='ResourceGroup'}) + #> + +<#Group Aggregation: No data generated in the storage account +$Aggregation1 = @{ name = 'PreTaxCost'; function='sum'} +$Aggregation2 = @{ name = 'Cost'; function='sum'} +$AggregationDict = @{costsum=$aggregation1; cost=$aggregation2} + +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-groupaggregation-t" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-06-29T13:00:00Z" ` +-RecurrencePeriodTo "2020-07-01T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" ` +-DatasetGrouping @(@{type='Dimension'; name='ResourceGroup'}) ` +-DatasetAggregation $AggregationDict +#> +<# +$orDimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceLocation' -Operator In -Value @('East US', 'West Europe') +$queryOrDimension = New-AzCostManagementQueryFilterObject -Dimension $orDimension +$orTag = New-AzCostManagementQueryComparisonExpressionObject -Name 'Environment' -Operator In -Value @('UAT', 'Prod') +$queryOrTag = New-AzCostManagementQueryFilterObject -Tag $orTag +$andOr = New-AzCostManagementQueryFilterObject -or @((New-AzCostManagementQueryFilterObject -Dimension $orDimension), (New-AzCostManagementQueryFilterObject -Tag $orTag)) + +$dimension = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceGroup' -Operator In -Value 'API' +$andDimension = New-AzCostManagementQueryFilterObject -Dimension $dimension +$fileter = New-AzCostManagementQueryFilterObject -And @($andOr, $andDimension) +#> +New-AzCostManagementExport -Debug -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name "ps-filter-t01" ` +-ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-07-05T00:00:00Z" ` +-RecurrencePeriodTo "2020-07-30T00:00:00Z" -Format "Csv" ` +-DestinationResourceId "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/lucas-manual-test/providers/Microsoft.Storage/storageAccounts/lucasstorageaccount" ` +-DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" ` +-DatasetGranularity "Daily" ` +-DatasetFilter $fileter + diff --git a/src/CostManagement/test/utils.ps1 b/src/CostManagement/test/utils.ps1 new file mode 100644 index 000000000000..71818c954ade --- /dev/null +++ b/src/CostManagement/test/utils.ps1 @@ -0,0 +1,93 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +function getUseModules() { + $usedModule = & 'gmo' + foreach($module in $usedModule) + { + $name = $module.Name + $version = $module.Version + Write-Host -ForegroundColor Green "Using module name: $name $version" + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + $env.location = 'eastus' + # For any resources you created for test, you should add it to $env here. + $exportName01 = 'export-' + (RandomString -allChars $false -len 6) + $exportName02 = 'export-' + (RandomString -allChars $false -len 6) + $exportName03 = 'export-' + (RandomString -allChars $false -len 6) + $exportName04 = 'export-' + (RandomString -allChars $false -len 6) + $exportName05 = 'export-' + (RandomString -allChars $false -len 6) + $exportName06 = 'export-' + (RandomString -allChars $false -len 6) + $exportName07 = 'export-' + (RandomString -allChars $false -len 6) + $exportName08 = 'export-' + (RandomString -allChars $false -len 6) + + $null = $env.Add('exportName01', $exportName01) + $null = $env.Add('exportName02', $exportName02) + $null = $env.Add('exportName03', $exportName03) + $null = $env.Add('exportName04', $exportName04) + $null = $env.Add('exportName05', $exportName05) + $null = $env.Add('exportName06', $exportName06) + $null = $env.Add('exportName07', $exportName07) + $null = $env.Add('exportName08', $exportName08) + + Write-Host -ForegroundColor Green "Create test group..." + $resourceGroup = 'costmanagement-rg-' + (RandomString -allChars $false -len 6) + Write-Host $resourceGroup + New-AzResourceGroup -Name $resourceGroup -Location $env.location + $null = $env.Add('resourceGroup', $resourceGroup) + Write-Host -ForegroundColor Green 'The test group create completed.' + + # Deploy storage account for test. + Write-Host -ForegroundColor Green "Deploying storage account..." + <# Cause error: The request content was invalid and could not be deserialized: 'Error converting value "staaccountuigcan" to type + 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition'. Path + 'properties.parameters.storageAccounts_wyunchistorageaccount_name', line 5, position 70.'. + + $staaccountName = 'staaccount' + (RandomString -allChars $false -len 6) + $staaccountParam = Get-Content .\test\deployment-templates\storage-account\parameters.json | ConvertFrom-Json + $staaccountParam.parameters.storageAccounts_name = $staaccountName + set-content -Path .\test\deployment-templates\storage-account\parameters.json -Value (ConvertTo-Json $staaccountParam) + #> + New-AzDeployment -Mode Incremental -TemplateFile .\test\deployment-templates\storage-account\template.json -TemplateParameterFile .\test\deployment-templates\storage-account\parameters.json -ResourceGroupName $env.resourceGroup + $staaccountName = 'staaccountjshubiu' # Value in template.json + $env.storageAccountId = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)/providers/Microsoft.Storage/storageAccounts/$($staaccountName)" + Start-Sleep -s 60 # Waiting storage account create complete. + Write-Host -ForegroundColor Green "The storage account deployed successfully." + + Write-Host -ForegroundColor Green "Create cost management export for test..." + $env.fromDate = (Get-Date).ToString() + $env.toDate = (Get-Date).AddDays(20).ToString() + New-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 ` + -ScheduleStatus "Active" -ScheduleRecurrence "Daily" ` + -RecurrencePeriodFrom $env.fromDate -RecurrencePeriodTo $env.toDate ` + -Format "Csv" ` + -DestinationResourceId $env.storageAccountId ` + -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" ` + -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" + + Invoke-AzCostManagementExecuteExport -Scope "subscriptions/$($env.SubscriptionId)" -ExportName $env.exportName01 + + Write-Host -ForegroundColor Green "The cost management export created successfully." + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) + +} +function cleanupEnv() { + # Clean resources you create for testing + Remove-AzResourceGroup -Name $env.resourceGroup +} +