Skip to content

Commit 88cfab0

Browse files
authored
Add test cases and examples of CostManagement. (#12325)
* Add test cases and example of CostManagement. * Modified test cases and example of CostManagement.
1 parent 893f24e commit 88cfab0

File tree

46 files changed

+4259
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4259
-1
lines changed

src/CostManagement/docs/Az.Cost.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
Module Name: Az.Cost
3+
Module Guid: e68ffeab-c2c5-4869-9306-c48c496e0cfd
4+
Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.cost
5+
Help Version: 1.0.0.0
6+
Locale: en-US
7+
---
8+
9+
# Az.Cost Module
10+
## Description
11+
Microsoft Azure PowerShell: Cost cmdlets
12+
13+
## Az.Cost Cmdlets
14+
### [Get-AzCostManagementExport](Get-AzCostManagementExport.md)
15+
The operation to get the export for the defined scope by export name.
16+
17+
### [Get-AzCostManagementExportExecutionHistory](Get-AzCostManagementExportExecutionHistory.md)
18+
The operation to get the execution history of an export for the defined scope by export name.
19+
20+
### [Invoke-AzCostManagementExecuteExport](Invoke-AzCostManagementExecuteExport.md)
21+
The operation to execute a export.
22+
23+
### [Invoke-AzCostManagementUsageQuery](Invoke-AzCostManagementUsageQuery.md)
24+
Query the usage data for scope defined.
25+
26+
### [New-AzCostManagementExport](New-AzCostManagementExport.md)
27+
The operation to create or update a export.
28+
Update operation requires latest eTag to be set in the request.
29+
You may obtain the latest eTag by performing a get operation.
30+
Create operation does not require eTag.
31+
32+
### [New-AzCostManagementQueryColumnObject](New-AzCostManagementQueryColumnObject.md)
33+
Create a in-memory object for QueryColumn
34+
35+
### [New-AzCostManagementQueryComparisonExpressionObject](New-AzCostManagementQueryComparisonExpressionObject.md)
36+
Create a in-memory object for QueryComparisonExpression
37+
38+
### [New-AzCostManagementQueryFilterObject](New-AzCostManagementQueryFilterObject.md)
39+
Create a in-memory object for QueryFilter
40+
41+
### [Remove-AzCostManagementExport](Remove-AzCostManagementExport.md)
42+
The operation to delete a export.
43+
44+
### [Update-AzCostManagementExport](Update-AzCostManagementExport.md)
45+
The operation to create or update a export.
46+
Update operation requires latest eTag to be set in the request.
47+
You may obtain the latest eTag by performing a get operation.
48+
Create operation does not require eTag.
49+
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
external help file:
3+
Module Name: Az.Cost
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/get-azcostmanagementexport
5+
schema: 2.0.0
6+
---
7+
8+
# Get-AzCostManagementExport
9+
10+
## SYNOPSIS
11+
The operation to get the export for the defined scope by export name.
12+
13+
## SYNTAX
14+
15+
### List (Default)
16+
```
17+
Get-AzCostManagementExport -Scope <String> [-DefaultProfile <PSObject>] [<CommonParameters>]
18+
```
19+
20+
### Get
21+
```
22+
Get-AzCostManagementExport -Name <String> -Scope <String> [-DefaultProfile <PSObject>] [<CommonParameters>]
23+
```
24+
25+
### GetViaIdentity
26+
```
27+
Get-AzCostManagementExport -InputObject <ICostIdentity> [-DefaultProfile <PSObject>] [<CommonParameters>]
28+
```
29+
30+
## DESCRIPTION
31+
The operation to get the export for the defined scope by export name.
32+
33+
## EXAMPLES
34+
35+
### Example 1: Get all cost management exports under a subscription
36+
```powershell
37+
PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f"
38+
39+
Name Type
40+
---- ----
41+
TestExport Microsoft.CostManagement/exports
42+
TestExport1 Microsoft.CostManagement/exports
43+
```
44+
45+
this command gets all cost management exports under a subscription.
46+
47+
### Example 2: Get a cost management export by name
48+
```powershell
49+
PS C:\> Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport'
50+
51+
Name Type
52+
---- ----
53+
TestExport Microsoft.CostManagement/exports
54+
```
55+
56+
This command gets a cost management export by name.
57+
58+
### Example 3: Get a cost management export by object
59+
```powershell
60+
PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -Name 'TestExport'
61+
PS C:\> Get-AzCostManagementExport -InputObject $export
62+
63+
Name Type
64+
---- ----
65+
TestExport Microsoft.CostManagement/exports
66+
```
67+
68+
This command gets a cost management export by object.
69+
70+
## PARAMETERS
71+
72+
### -DefaultProfile
73+
The credentials, account, tenant, and subscription used for communication with Azure.
74+
75+
```yaml
76+
Type: System.Management.Automation.PSObject
77+
Parameter Sets: (All)
78+
Aliases: AzureRMContext, AzureCredential
79+
80+
Required: False
81+
Position: Named
82+
Default value: None
83+
Accept pipeline input: False
84+
Accept wildcard characters: False
85+
```
86+
87+
### -InputObject
88+
Identity Parameter
89+
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
90+
91+
```yaml
92+
Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity
93+
Parameter Sets: GetViaIdentity
94+
Aliases:
95+
96+
Required: True
97+
Position: Named
98+
Default value: None
99+
Accept pipeline input: True (ByValue)
100+
Accept wildcard characters: False
101+
```
102+
103+
### -Name
104+
Export Name.
105+
106+
```yaml
107+
Type: System.String
108+
Parameter Sets: Get
109+
Aliases: ExportName
110+
111+
Required: True
112+
Position: Named
113+
Default value: None
114+
Accept pipeline input: False
115+
Accept wildcard characters: False
116+
```
117+
118+
### -Scope
119+
The scope associated with query and export operations.
120+
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.
121+
122+
```yaml
123+
Type: System.String
124+
Parameter Sets: Get, List
125+
Aliases:
126+
127+
Required: True
128+
Position: Named
129+
Default value: None
130+
Accept pipeline input: False
131+
Accept wildcard characters: False
132+
```
133+
134+
### CommonParameters
135+
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).
136+
137+
## INPUTS
138+
139+
### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity
140+
141+
## OUTPUTS
142+
143+
### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExport
144+
145+
## NOTES
146+
147+
ALIASES
148+
149+
COMPLEX PARAMETER PROPERTIES
150+
151+
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.
152+
153+
154+
INPUTOBJECT <ICostIdentity>: Identity Parameter
155+
- `[AlertId <String>]`: Alert ID
156+
- `[ExportName <String>]`: Export Name.
157+
- `[ExternalCloudProviderId <String>]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
158+
- `[ExternalCloudProviderType <ExternalCloudProviderType?>]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
159+
- `[Id <String>]`: Resource identity path
160+
- `[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.
161+
- `[ViewName <String>]`: View name
162+
163+
## RELATED LINKS
164+
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
external help file:
3+
Module Name: Az.Cost
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.cost/get-azcostmanagementexportexecutionhistory
5+
schema: 2.0.0
6+
---
7+
8+
# Get-AzCostManagementExportExecutionHistory
9+
10+
## SYNOPSIS
11+
The operation to get the execution history of an export for the defined scope by export name.
12+
13+
## SYNTAX
14+
15+
### Get (Default)
16+
```
17+
Get-AzCostManagementExportExecutionHistory -ExportName <String> -Scope <String> [-DefaultProfile <PSObject>]
18+
[<CommonParameters>]
19+
```
20+
21+
### GetViaIdentity
22+
```
23+
Get-AzCostManagementExportExecutionHistory -InputObject <ICostIdentity> [-DefaultProfile <PSObject>]
24+
[<CommonParameters>]
25+
```
26+
27+
## DESCRIPTION
28+
The operation to get the execution history of an export for the defined scope by export name.
29+
30+
## EXAMPLES
31+
32+
### Example 1: Get execution history of cost management export
33+
```powershell
34+
PS C:\> Get-AzCostManagementExportExecutionHistory -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t"
35+
36+
ExecutionType ProcessingStartTime ProcessingEndTime Status FileName
37+
------------- ------------------- ----------------- ------ --------
38+
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
39+
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
40+
```
41+
42+
This command gets execution history of cost management export.
43+
44+
### Example 2: Get execution history of cost management export by object
45+
```powershell
46+
PS C:\> $export = Get-AzCostManagementExport -Scope "subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f" -ExportName "ps-customcolum-t"
47+
PS C:\> $export | Get-AzCostManagementExportExecutionHistory -InputObject $export
48+
49+
ExecutionType ProcessingStartTime ProcessingEndTime Status FileName
50+
------------- ------------------- ----------------- ------ --------
51+
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
52+
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
53+
```
54+
55+
This command gets execution history of cost management export by object.
56+
57+
## PARAMETERS
58+
59+
### -DefaultProfile
60+
The credentials, account, tenant, and subscription used for communication with Azure.
61+
62+
```yaml
63+
Type: System.Management.Automation.PSObject
64+
Parameter Sets: (All)
65+
Aliases: AzureRMContext, AzureCredential
66+
67+
Required: False
68+
Position: Named
69+
Default value: None
70+
Accept pipeline input: False
71+
Accept wildcard characters: False
72+
```
73+
74+
### -ExportName
75+
Export Name.
76+
77+
```yaml
78+
Type: System.String
79+
Parameter Sets: Get
80+
Aliases:
81+
82+
Required: True
83+
Position: Named
84+
Default value: None
85+
Accept pipeline input: False
86+
Accept wildcard characters: False
87+
```
88+
89+
### -InputObject
90+
Identity Parameter
91+
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
92+
93+
```yaml
94+
Type: Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity
95+
Parameter Sets: GetViaIdentity
96+
Aliases:
97+
98+
Required: True
99+
Position: Named
100+
Default value: None
101+
Accept pipeline input: True (ByValue)
102+
Accept wildcard characters: False
103+
```
104+
105+
### -Scope
106+
The scope associated with query and export operations.
107+
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.
108+
109+
```yaml
110+
Type: System.String
111+
Parameter Sets: Get
112+
Aliases:
113+
114+
Required: True
115+
Position: Named
116+
Default value: None
117+
Accept pipeline input: False
118+
Accept wildcard characters: False
119+
```
120+
121+
### CommonParameters
122+
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).
123+
124+
## INPUTS
125+
126+
### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.ICostIdentity
127+
128+
## OUTPUTS
129+
130+
### Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20191101.IExportExecution
131+
132+
## NOTES
133+
134+
ALIASES
135+
136+
COMPLEX PARAMETER PROPERTIES
137+
138+
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.
139+
140+
141+
INPUTOBJECT <ICostIdentity>: Identity Parameter
142+
- `[AlertId <String>]`: Alert ID
143+
- `[ExportName <String>]`: Export Name.
144+
- `[ExternalCloudProviderId <String>]`: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
145+
- `[ExternalCloudProviderType <ExternalCloudProviderType?>]`: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
146+
- `[Id <String>]`: Resource identity path
147+
- `[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.
148+
- `[ViewName <String>]`: View name
149+
150+
## RELATED LINKS
151+

0 commit comments

Comments
 (0)