-
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
Merged
wyunchi-ms
merged 3 commits into
Azure:wyunchi/CostManagement
from
LucasYao93:lucas/CostManagement
Jul 7, 2020
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <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. | ||
|
|
||
| ## 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 | ||
|
|
151 changes: 151 additions & 0 deletions
151
src/CostManagement/docs/Get-AzCostManagementExportExecutionHistory.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <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" | ||
|
|
||
| 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 <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 | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is not accurate.
Scopeis not start with/. We need to change the description of allScope.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.
This should be generated automatically. I shouldn't be able to change. isn't it ?