-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add test cases and examples of CostManagement. #12325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| --- | ||
| 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 <String> [-DefaultProfile <PSObject>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### Get | ||
| ``` | ||
| Get-AzCostManagementExport -Name <String> -Scope <String> [-DefaultProfile <PSObject>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### GetViaIdentity | ||
| ``` | ||
| Get-AzCostManagementExport -InputObject <ICostIdentity> [-DefaultProfile <PSObject>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## 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. | ||
|
|
||
| ### Example 4: Get a cost management export by pipeline | ||
| ```powershell | ||
| PS C:\> @{Id = 'subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExport' } | Get-AzCostManagementExport | ||
|
|
||
| Name Type | ||
| ---- ---- | ||
| TestExport Microsoft.CostManagement/exports | ||
| ``` | ||
|
|
||
| This command gets a cost management export by pipeline. | ||
|
|
||
| ## 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 <ICostIdentity>: Identity Parameter | ||
| - `[AlertId <String>]`: Alert ID | ||
| - `[ExportName <String>]`: Export Name. | ||
| - `[ExternalCloudProviderId <String>]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. | ||
| - `[ExternalCloudProviderType <ExternalCloudProviderType?>]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. | ||
| - `[Id <String>]`: Resource identity path | ||
| - `[Scope <String>]`: 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 <String>]`: View name | ||
|
|
||
| ## RELATED LINKS | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| --- | ||
| 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 <String> -Scope <String> [-DefaultProfile <PSObject>] | ||
| [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### GetViaIdentity | ||
| ``` | ||
| Get-AzCostManagementExportExecutionHistory -InputObject <ICostIdentity> [-DefaultProfile <PSObject>] | ||
| [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## 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" | ||
|
|
||
| Name Type | ||
| ---- ---- | ||
| ``` | ||
|
|
||
| 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:\> Get-AzCostManagementExportExecutionHistory -InputObject $export | ||
|
|
||
| Name Type | ||
| ---- ---- | ||
|
||
| ``` | ||
|
|
||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not accurate.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be generated automatically. I shouldn't be able to change. isn't it ? |
||
|
|
||
| ```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 <ICostIdentity>: Identity Parameter | ||
| - `[AlertId <String>]`: Alert ID | ||
| - `[ExportName <String>]`: Export Name. | ||
| - `[ExternalCloudProviderId <String>]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. | ||
| - `[ExternalCloudProviderType <ExternalCloudProviderType?>]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. | ||
| - `[Id <String>]`: Resource identity path | ||
| - `[Scope <String>]`: 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 <String>]`: View name | ||
|
|
||
| ## RELATED LINKS | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think this example is not necessary for this cmdlet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done