diff --git a/src/CostManagement/.gitattributes b/src/CostManagement/.gitattributes new file mode 100644 index 000000000000..2125666142eb --- /dev/null +++ b/src/CostManagement/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/src/CostManagement/.gitignore b/src/CostManagement/.gitignore new file mode 100644 index 000000000000..aa1432babfa4 --- /dev/null +++ b/src/CostManagement/.gitignore @@ -0,0 +1,15 @@ +bin +obj +.vs +generated +internal +exports +tools +custom/*.psm1 +test/*-TestResults.xml +/*.ps1 +/*.ps1xml +/*.psm1 +/*.snk +/*.csproj +/*.nuspec \ No newline at end of file diff --git a/src/CostManagement/Az.CostManagement.psd1 b/src/CostManagement/Az.CostManagement.psd1 new file mode 100644 index 000000000000..bc15b18ea981 --- /dev/null +++ b/src/CostManagement/Az.CostManagement.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = '4cd9af10-559e-4fb9-8dcd-d3e8eb9e03b7' + RootModule = './Az.CostManagement.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: Cost cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.CostManagement.private.dll' + FormatsToProcess = './Az.CostManagement.format.ps1xml' + FunctionsToExport = 'Get-AzCostManagementExport', 'Get-AzCostManagementExportExecutionHistory', 'Invoke-AzCostManagementExecuteExport', 'Invoke-AzCostManagementQuery', 'New-AzCostManagementExport', 'New-AzCostManagementQueryComparisonExpressionObject', 'New-AzCostManagementQueryFilterObject', 'Remove-AzCostManagementExport', 'Update-AzCostManagementExport', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Cost' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/CostManagement/custom/Invoke-AzCostManagementQuery.ps1 b/src/CostManagement/custom/Invoke-AzCostManagementQuery.ps1 new file mode 100644 index 000000000000..f3dd057cfe6a --- /dev/null +++ b/src/CostManagement/custom/Invoke-AzCostManagementQuery.ps1 @@ -0,0 +1,276 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Query the usage data for scope defined. +.Description +Query the usage data for scope defined. +#> +function Invoke-AzCostManagementQuery { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryResult])] +[CmdletBinding(DefaultParameterSetName='UsageExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="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.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # 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. + ${Scope}, + + [Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + ${ExternalCloudProviderId}, + + [Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The external cloud provider type associated with dimension/query operations.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExternalCloudProviderType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExternalCloudProviderType] + # The external cloud provider type associated with dimension/query operations. + # This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + ${ExternalCloudProviderType}, + + [Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="The time frame for pulling data for the query.")] + [Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The time frame for pulling data for the query.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType] + # The time frame for pulling data for the query. + # If custom, then a specific time period must be provided. + ${Timeframe}, + + [Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="The type of the query.")] + [Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The type of the query.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType] + # The type of the query. + ${Type}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="Array of column names to be included in the query.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Array of column names to be included in the query.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String[]] + # 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. + ${ConfigurationColumn}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="Dictionary of aggregation expression to use in the query.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Dictionary of aggregation expression to use in the query.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryDatasetAggregation]))] + [System.Collections.Hashtable] + # 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. + ${DatasetAggregation}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="Has filter expression to use in the query.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Has filter expression to use in the query.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryFilter] + # Has filter expression to use in the query. + # To construct, see NOTES section for DATASETFILTER properties and create a hash table. + ${DatasetFilter}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="The granularity of rows in the query.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="The granularity of rows in the query.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType] + # The granularity of rows in the query. + ${DatasetGranularity}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage='Array of group by expression to use in the query.')] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Array of group by expression to use in the query.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryGrouping[]] + # 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. + ${DatasetGrouping}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="The start date to pull data from.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="The start date to pull data from.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The start date to pull data from. + ${TimePeriodFrom}, + + [Parameter(ParameterSetName='UsageExpanded', HelpMessage="The end date to pull data to.")] + [Parameter(ParameterSetName='UsageExpanded1', HelpMessage="The end date to pull data to.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The end date to pull data to. + ${TimePeriodTo}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + + process { + $ApiVersion = '2019-11-01' + $URL = '' + if ($PSBoundParameters.ContainsKey('ExternalCloudProviderType')) { + $URL = [System.Text.RegularExpressions.Regex]::Replace( + "providers/Microsoft.CostManagement/$ExternalCloudProviderType/$ExternalCloudProviderId/query?api-version=$ApiVersion" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2") + } else { + $URL = [System.Text.RegularExpressions.Regex]::Replace( + "$Scope/providers/Microsoft.CostManagement/query?api-version=$ApiVersion", "\\?&*$|&*$|(\\?)&+|(&)&+","$1$2") + } + + $Request = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryDefinition]::New() + if ($PSBoundParameters.ContainsKey('ConfigurationColumn')) { + $Request.ConfigurationColumn = $ConfigurationColumn + } + if ($PSBoundParameters.ContainsKey('DatasetAggregation')) { + $Request.DatasetAggregation = $DatasetAggregation + } + if ($PSBoundParameters.ContainsKey('DatasetFilter')) { + $Request.DatasetFilter = $DatasetFilter + } + if ($PSBoundParameters.ContainsKey('DatasetGranularity')) { + $Request.DatasetGranularity = $DatasetGranularity + } + if ($PSBoundParameters.ContainsKey('DatasetGrouping')) { + $Request.DatasetGrouping = $DatasetGrouping + } + if ($PSBoundParameters.ContainsKey('TimePeriodFrom')) { + $Request.TimePeriodFrom = $TimePeriodFrom + } + if ($PSBoundParameters.ContainsKey('TimePeriodTo')) { + $Request.TimePeriodTo = $TimePeriodTo + } + if ($PSBoundParameters.ContainsKey('Timeframe')) { + $Request.Timeframe = $Timeframe + } + if ($PSBoundParameters.ContainsKey('Type')) { + $Request.Type = $Type + } + $Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryResult]::New() + $SkipToken = $null + $RowList = New-Object System.Collections.Generic.List[System.Collections.Generic.List[string]] + while ($true) { + $Response = Invoke-AzCostManagementUsageQueryInternal -URL $URL -SkipToken $SkipToken -Payload $Request.ToJsonString() -Scope $Scope + $Result.Column = $Response.Column + foreach ($Row in $Response.Row) { + $RowList.Add($Row) + } + if ($null -ne $Response.NextLink -and '' -ne $Response.nextlink) + { + $SkipToken = $Response.nextLink + } else { + break + } + } + $Result.Row = $RowList + return $Result + } +} + +function Invoke-AzCostManagementUsageQueryInternal { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryResult])] + param( + [System.String] + ${URL}, + [System.String] + ${SkipToken}, + [System.String] + ${Payload}, + [System.String] + ${Scope} + ) + process { + if ($null -ne $SkipToken -and $SkipToken -ne '') { + $URL = "$URL&$SkipToken" + } + $ResponseContent = (Invoke-AzRest -Path $URL -Payload $Payload -Method POST).Content | ConvertFrom-Json + + $Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryResult]::New() + if ($null -ne $ResponseContent.Properties.NextLink) + { + $Result.NextLink = $ResponseContent.Properties.NextLink.split('&')[1] + } + + $ColumnList = New-Object System.Collections.Generic.List[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryColumn] + foreach ($Column in $ResponseContent.Properties.Columns) { + Write-Host $Column.ToString() + $QueryColumn = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryColumn]::New() + $QueryColumn.Name = $Column.Name + $QueryColumn.Type = $Column.Type + $ColumnList.Add($QueryColumn) + } + $Result.Column = $ColumnList + + $RowList = New-Object System.Collections.Generic.List[System.Collections.Generic.List[string]] + foreach ($Row in $ResponseContent.Properties.Rows) { + $QueryRow = New-Object System.Collections.Generic.List[string] + foreach ($Item in $Row) { + $QueryRow.Add($Item.ToString()) + } + $RowList.Add($QueryRow) + } + $Result.Row = $RowList + + return $Result + } +} diff --git a/src/CostManagement/custom/New-AzCostManagementExport.ps1 b/src/CostManagement/custom/New-AzCostManagementExport.ps1 new file mode 100644 index 000000000000..fa6166f87426 --- /dev/null +++ b/src/CostManagement/custom/New-AzCostManagementExport.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.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. +.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. +#> +function New-AzCostManagementExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IExport])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('ExportName')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # Export Name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + ${Scope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String[]] + # Array of column names to be included in the export. + # If not provided then the export will include all available columns. + # The available columns can vary by customer channel (see examples). + ${ConfigurationColumn}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType] + # The granularity of rows in the export. + # Currently only 'Daily' is supported. + ${DataSetGranularity}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType] + # The time frame for pulling data for the export. + # If custom, then a specific time period must be provided. + ${DefinitionTimeframe}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType] + # The type of the export. + # Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. + ${DefinitionType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The name of the container where exports will be uploaded. + ${DestinationContainer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The resource id of the storage account where exports will be delivered. + ${DestinationResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The name of the directory where exports will be uploaded. + ${DestinationRootFolderPath}, + + # [Parameter()] + # [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + # [System.String] + # # eTag of the resource. + # # To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + # ${ETag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.FormatType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.FormatType] + # The format of the export being delivered. + # Currently only 'Csv' is supported. + ${Format}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The start date of recurrence. + ${RecurrencePeriodFrom}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The end date of recurrence. + ${RecurrencePeriodTo}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.RecurrenceType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.RecurrenceType] + # The schedule recurrence. + ${ScheduleRecurrence}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType] + # The status of the export's schedule. + # If 'Inactive', the export's schedule is paused. + ${ScheduleStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The start date for export data. + ${TimePeriodFrom}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The end date for export data. + ${TimePeriodTo}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.CostManagement.private\New-AzCostManagementExport_CreateExpanded'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/CostManagement/custom/New-AzCostManagementQueryComparisonExpressionObject.ps1 b/src/CostManagement/custom/New-AzCostManagementQueryComparisonExpressionObject.ps1 new file mode 100644 index 000000000000..ea1030077d7f --- /dev/null +++ b/src/CostManagement/custom/New-AzCostManagementQueryComparisonExpressionObject.ps1 @@ -0,0 +1,52 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a in-memory object for QueryComparisonExpression +.Description +Create a in-memory object for QueryComparisonExpression + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryComparisonExpression +.Link +https://docs.microsoft.com/en-us/powershell/module/az.CostManagement/new-AzCostManagementQueryComparisonExpressionObject +#> +function New-AzCostManagementQueryComparisonExpressionObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryComparisonExpression')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(Mandatory, HelpMessage="The name of the column to use in comparison.")] + [string] + $Name, + [Parameter(Mandatory, HelpMessage="The operator to use for comparison.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.OperatorType] + $Operator, + [Parameter(Mandatory, HelpMessage="Array of values to use for comparison.")] + [string[]] + $Value + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryComparisonExpression]::New() + + $Object.Name = $Name + $Object.Operator = $Operator + $Object.Value = $Value + return $Object + } +} + diff --git a/src/CostManagement/custom/New-AzCostManagementQueryFilterObject.ps1 b/src/CostManagement/custom/New-AzCostManagementQueryFilterObject.ps1 new file mode 100644 index 000000000000..946aedfa598c --- /dev/null +++ b/src/CostManagement/custom/New-AzCostManagementQueryFilterObject.ps1 @@ -0,0 +1,60 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a in-memory object for QueryFilter +.Description +Create a in-memory object for QueryFilter + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryFilter +.Link +https://docs.microsoft.com/en-us/powershell/module/az.CostManagement/new-AzCostManagementQueryFilterObject +#> +function New-AzCostManagementQueryFilterObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryFilter')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The logical `"AND`" expression. Must have at least 2 items.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryFilter[]] + $And, + [Parameter(HelpMessage="Has comparison expression for a dimensions.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryComparisonExpression] + $Dimensions, + [Parameter(HelpMessage="The logical `"NOT`" expression.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryFilter] + $Not, + [Parameter(HelpMessage="The logical `"OR`" expression. Must have at least 2 items.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryFilter[]] + $Or, + [Parameter(HelpMessage="Has comparison expression for a tag.")] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IQueryComparisonExpression] + $Tag + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.QueryFilter]::New() + + $Object.And = $And + $Object.Dimensions = $Dimensions + $Object.Not = $Not + $Object.Or = $Or + $Object.Tag = $Tag + return $Object + } +} + diff --git a/src/CostManagement/custom/Update-AzCostManagementExport.ps1 b/src/CostManagement/custom/Update-AzCostManagementExport.ps1 new file mode 100644 index 000000000000..3ecf17df8afb --- /dev/null +++ b/src/CostManagement/custom/Update-AzCostManagementExport.ps1 @@ -0,0 +1,294 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.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. +.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. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.ICostManagementIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IExport +.Notes +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 +.Link +https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/update-azcostmanagementexport +#> +function Update-AzCostManagementExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.IExport])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('ExportName')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # Export Name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [System.String] + # This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + ${Scope}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.ICostManagementIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String[]] + # Array of column names to be included in the export. + # If not provided then the export will include all available columns. + # The available columns can vary by customer channel (see examples). + ${ConfigurationColumn}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType] + # The granularity of rows in the export. + # Currently only 'Daily' is supported. + ${DataSetGranularity}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType] + # The time frame for pulling data for the export. + # If custom, then a specific time period must be provided. + ${DefinitionTimeframe}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType] + # The type of the export. + # Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. + ${DefinitionType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The name of the container where exports will be uploaded. + ${DestinationContainer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The resource id of the storage account where exports will be delivered. + ${DestinationResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # The name of the directory where exports will be uploaded. + ${DestinationRootFolderPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.String] + # eTag of the resource. + # To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + ${ETag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.FormatType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.FormatType] + # The format of the export being delivered. + # Currently only 'Csv' is supported. + ${Format}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The start date of recurrence. + ${RecurrencePeriodFrom}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The end date of recurrence. + ${RecurrencePeriodTo}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.RecurrenceType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.RecurrenceType] + # The schedule recurrence. + ${ScheduleRecurrence}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType])] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType] + # The status of the export's schedule. + # If 'Inactive', the export's schedule is paused. + ${ScheduleStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The start date for export data. + ${TimePeriodFrom}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] + [System.DateTime] + # The end date for export data. + ${TimePeriodTo}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + try { + $getExport + if($PSBoundParameters['InputObject'] -ne $null) + { + $InputExportObject = $PSBoundParameters['InputObject'] + $getExport = Get-AzCostManagementExport -InputObject $InputExportObject + }else{ + $InputExportScope = $PSBoundParameters['Scope'] + $InputExportName = $PSBoundParameters['Name'] + $getExport = Get-AzCostManagementExport -Scope $InputExportScope -Name $InputExportName + } + $null = $PSBoundParameters.Add("ETag",$getExport.Etag) + if($PSBoundParameters['DataSetGranularity'] -eq $null) + { + $null = $PSBoundParameters.Add("DataSetGranularity",$getExport.DataSetGranularity) + } + if($PSBoundParameters['DefinitionTimeframe'] -eq $null) + { + $null = $PSBoundParameters.Add("DefinitionTimeframe",$getExport.DefinitionTimeframe) + } + if($PSBoundParameters['DefinitionType'] -eq $null) + { + $null = $PSBoundParameters.Add("DefinitionType",$getExport.DefinitionType) + } + if($PSBoundParameters['DestinationContainer'] -eq $null) + { + $null = $PSBoundParameters.Add("DestinationContainer",$getExport.DestinationContainer) + } + if($PSBoundParameters['DestinationResourceId'] -eq $null) + { + $null = $PSBoundParameters.Add("DestinationResourceId",$getExport.DestinationResourceId) + } + if($PSBoundParameters['DestinationRootFolderPath'] -eq $null) + { + $null = $PSBoundParameters.Add("DestinationRootFolderPath",$getExport.DestinationRootFolderPath) + } + if($PSBoundParameters['Format'] -eq $null) + { + $null = $PSBoundParameters.Add("Format",$getExport.Format) + } + if($PSBoundParameters['RecurrencePeriodFrom'] -eq $null) + { + $null = $PSBoundParameters.Add("RecurrencePeriodFrom",$getExport.RecurrencePeriodFrom) + } + if($PSBoundParameters['RecurrencePeriodTo'] -eq $null) + { + $null = $PSBoundParameters.Add("RecurrencePeriodTo",$getExport.RecurrencePeriodTo) + } + if($PSBoundParameters['ScheduleStatus'] -eq $null) + { + $null = $PSBoundParameters.Add("ScheduleStatus",$getExport.ScheduleStatus) + } + if($PSBoundParameters['ScheduleRecurrence'] -eq $null) + { + $null = $PSBoundParameters.Add("ScheduleRecurrence",$getExport.ScheduleRecurrence) + } + Az.CostManagement.internal\Update-AzCostManagementExport @PSBoundParameters + } catch { + throw + } + } +} \ No newline at end of file diff --git a/src/CostManagement/custom/readme.md b/src/CostManagement/custom/readme.md new file mode 100644 index 000000000000..f488fa1a08b0 --- /dev/null +++ b/src/CostManagement/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.CostManagement` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.CostManagement.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.CostManagement` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.CostManagement.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.CostManagement.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.CostManagement`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.CostManagement`. +- `Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.CostManagement`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/CostManagement/docs/Az.CostManagement.md b/src/CostManagement/docs/Az.CostManagement.md new file mode 100644 index 000000000000..517827181467 --- /dev/null +++ b/src/CostManagement/docs/Az.CostManagement.md @@ -0,0 +1,46 @@ +--- +Module Name: Az.CostManagement +Module Guid: 4cd9af10-559e-4fb9-8dcd-d3e8eb9e03b7 +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.CostManagement Module +## Description +Microsoft Azure PowerShell: Cost cmdlets + +## Az.CostManagement 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 and export name. + +### [Invoke-AzCostManagementExecuteExport](Invoke-AzCostManagementExecuteExport.md) +The operation to execute an export. + +### [Invoke-AzCostManagementQuery](Invoke-AzCostManagementQuery.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-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..0e448b2a32fe --- /dev/null +++ b/src/CostManagement/docs/Get-AzCostManagementExport.md @@ -0,0 +1,171 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/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 [-Expand ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzCostManagementExport -Name -Scope [-Expand ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzCostManagementExport -InputObject [-Expand ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The operation to get the export for the defined scope by export name. + +## EXAMPLES + +### Example 1: Get all AzCostManagementExports by scope +```powershell +PS C:\> Get-AzCostManagementExport -Scope 'subscriptions/**********' + +ETag Name Type +---- ---- ---- +"************" TestExport Microsoft.CostManagement/exports +"************" TestExport1 Microsoft.CostManagement/exports +"************" TestExport2 Microsoft.CostManagement/exports +``` + +Get all AzCostManagementExports by Scope + +### Example 2: Get AzCostManagementExport by Name and scope +```powershell +PS C:\> Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' + +ETag Name Type +---- ---- ---- +"************" TestExport Microsoft.CostManagement/exports +``` + +Get AzCostManagementExport by Name and scope + +## 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 +``` + +### -Expand +May be used to expand the properties within an export. +Currently only 'runHistory' is supported and will return information for the last 10 executions of the export. + +```yaml +Type: System.String +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.CostManagement.Models.ICostManagementIdentity +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 +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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.CostManagement.Models.ICostManagementIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.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..ffafcc7d5381 --- /dev/null +++ b/src/CostManagement/docs/Get-AzCostManagementExportExecutionHistory.md @@ -0,0 +1,150 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/get-azcostmanagementexportexecutionhistory +schema: 2.0.0 +--- + +# Get-AzCostManagementExportExecutionHistory + +## SYNOPSIS +The operation to get the execution history of an export for the defined scope and 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 and export name. + +## EXAMPLES + +### Example 1: Get AzCostManagementExportExecutionHistory +```powershell +PS C:\> Get-AzCostManagementExportExecutionHistory -ExportName 'TestExport' -Scope 'subscriptions/**********' + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +Scheduled 2020/6/11 12:03:20 2020/6/11 12:03:43 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +Scheduled 2020/6/12 12:03:37 2020/6/12 12:03:48 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +``` + +Get AzCostManagementExportExecutionHistory By ExportName and Scope + +### Example 2: Get AzCostManagementExportExecutionHistory by InputObject +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' +Get-AzCostManagementExportExecutionHistory -InputObject $getExport + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +Scheduled 2020/6/11 12:03:20 2020/6/11 12:03:43 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +Scheduled 2020/6/12 12:03:37 2020/6/12 12:03:48 Completed ad-hoc/TestExport/20200601-20200630/ +``` + +Get AzCostManagementExportExecutionHistory By InputObject + +## 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.CostManagement.Models.ICostManagementIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Scope +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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.CostManagement.Models.ICostManagementIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.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..f9c775b6ec69 --- /dev/null +++ b/src/CostManagement/docs/Invoke-AzCostManagementExecuteExport.md @@ -0,0 +1,188 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/invoke-azcostmanagementexecuteexport +schema: 2.0.0 +--- + +# Invoke-AzCostManagementExecuteExport + +## SYNOPSIS +The operation to execute an 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 an export. + +## EXAMPLES + +### Example 1: Invoke Export by ExportName and Scope +```powershell +PS C:\> Invoke-AzCostManagementExecuteExport -ExportName 'TestExport' -Scope 'subscriptions/**********' + +``` + +Invoke Export by ExportName and Scope + +### Example 2: Invoke Export by InputObject +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' +Invoke-AzCostManagementExecuteExport -InputObject $getExport + +``` + +Invoke Export by InputObject + +## 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.CostManagement.Models.ICostManagementIdentity +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 +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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.CostManagement.Models.ICostManagementIdentity + +## 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-AzCostManagementQuery.md b/src/CostManagement/docs/Invoke-AzCostManagementQuery.md new file mode 100644 index 000000000000..8852e2339f2a --- /dev/null +++ b/src/CostManagement/docs/Invoke-AzCostManagementQuery.md @@ -0,0 +1,329 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/invoke-azcostmanagementquery +schema: 2.0.0 +--- + +# Invoke-AzCostManagementQuery + +## SYNOPSIS +Query the usage data for scope defined. + +## SYNTAX + +### UsageExpanded (Default) +``` +Invoke-AzCostManagementQuery -Scope -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UsageExpanded1 +``` +Invoke-AzCostManagementQuery -ExternalCloudProviderId + -ExternalCloudProviderType -Timeframe -Type + [-ConfigurationColumn ] [-DatasetAggregation ] [-DatasetFilter ] + [-DatasetGranularity ] [-DatasetGrouping ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Query the usage data for scope defined. + +## EXAMPLES + +### Example 1: Invoke AzCostManagementQuery by Scope +```powershell +PS C:\> Invoke-AzCostManagementQuery -Scope "/subscriptions/***********" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'Daily' + +Column Row +------ --- +{UsageDate, Currency} {20201101 USD, 20201102 USD, 20201103 USD, 20201104 USD…} +``` + +Invoke AzCostManagementQuery by Scope + +### Example 2: Invoke AzCostManagementQuery by Scope with Dimensions +```powershell +PS C:\> $dimensions = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceGroup' -Operator 'In' -Value 'API' +$filter = New-AzCostManagementQueryFilterObject -Dimensions $dimensions +Invoke-AzCostManagementQuery -Type Usage -Scope "subscriptions/***********" -DatasetGranularity 'Monthly' -DatasetFilter $filter -Timeframe MonthToDate -Debug + + +Column Row +------ --- +{BillingMonth, Currency} {} +``` + +Invoke AzCostManagementQuery by Scope with Dimensions + +## 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.CostManagement.Models.Api20200601.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.CostManagement.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.CostManagement.Models.Api20200601.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.CostManagement.Support.ExternalCloudProviderType +Parameter Sets: UsageExpanded1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +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: 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.CostManagement.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.CostManagement.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.CostManagement.Models.Api20200601.IQueryDefinition + +### Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.ICostIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.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. + - `[Dimensions ]`: 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. + +## RELATED LINKS + diff --git a/src/CostManagement/docs/New-AzCostManagementExport.md b/src/CostManagement/docs/New-AzCostManagementExport.md new file mode 100644 index 000000000000..7e575be45fc5 --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementExport.md @@ -0,0 +1,361 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/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 ] + [-DataSetGranularity ] [-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 an AzCostManagementExport +```powershell +PS C:\> New-AzCostManagementExport -Scope "subscriptions/***********" -Name "CostManagementExportTest" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-10-31T20:00:00Z" -RecurrencePeriodTo "2020-11-30T00:00:00Z" -Format "Csv" -DestinationResourceId "/subscriptions/*************/resourceGroups/ResourceGroupTest/providers/Microsoft.Storage/storageAccounts/storageAccountTest" ` -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfosagdhaghj Microsoft.CostManagement/exports +``` + +Create an AzCostManagementExport + +## PARAMETERS + +### -ConfigurationColumn +Array of column names to be included in the export. +If not provided then the export will include all available columns. +The available columns can vary by customer channel (see examples). + +```yaml +Type: System.String[] +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 export. +Currently only 'Daily' is supported. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType +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 export. +If custom, then a specific time period must be provided. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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 export. +Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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 +[Parameter()] +[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')] +[System.String] +# eTag of the resource. +# To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. +${ETag}, +The format of the export being delivered. +Currently only 'Csv' is supported. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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.CostManagement.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 export's schedule. +If 'Inactive', the export's schedule is paused. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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 for export data. + +```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 for export data. + +```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.CostManagement.Models.Api20200601.IExport + +## 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..9d238d9a8aeb --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementQueryComparisonExpressionObject.md @@ -0,0 +1,97 @@ +--- +external help file: +Module Name: Az.CostManagement +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.CostManagement.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.CostManagement.Models.Api20200601.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..12170474f4ce --- /dev/null +++ b/src/CostManagement/docs/New-AzCostManagementQueryFilterObject.md @@ -0,0 +1,183 @@ +--- +external help file: +Module Name: Az.CostManagement +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 ] [-Dimensions ] + [-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.Api20200601.QueryComparisonExpression +Not : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter +Or : {Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter, Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter} +Tag : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.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.CostManagement.Models.Api20200601.IQueryFilter[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Dimensions +Has comparison expression for a dimensions. +To construct, see NOTES section for DIMENSIONS properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.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.CostManagement.Models.Api20200601.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.CostManagement.Models.Api20200601.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.CostManagement.Models.Api20200601.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.CostManagement.Models.Api20200601.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. + - `[Dimensions ]`: 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 + +DIMENSIONS : Has comparison expression for a dimensions. + - `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. + - `[Dimensions ]`: 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. + - `[Dimensions ]`: 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..145b0c8a8a17 --- /dev/null +++ b/src/CostManagement/docs/Remove-AzCostManagementExport.md @@ -0,0 +1,190 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/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: Delete the AzCostManagementExport by Scope and Name +```powershell +PS C:\> Remove-AzCostManagementExport -Scope 'subscriptions/********' -name 'TestExportDatasetAggregationInfoYouri' + + +``` + +Delete the AzCostManagementExport By Scope and ExportName + +### Example 2: Delete the AzCostManagementExport by Export Object +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Scope 'subscriptions/*********' -name 'TestExportDatasetAggregationYouori' +Remove-AzCostManagementExport -InputObject $getExport + + +``` + +Delete the AzCostManagementExport By InputObject + +## 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.CostManagement.Models.ICostManagementIdentity +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 +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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.CostManagement.Models.ICostManagementIdentity + +## 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..e1f66ce4e5c0 --- /dev/null +++ b/src/CostManagement/docs/Update-AzCostManagementExport.md @@ -0,0 +1,426 @@ +--- +external help file: +Module Name: Az.CostManagement +online version: https://docs.microsoft.com/en-us/powershell/module/az.costmanagement/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 ] + [-DataSetGranularity ] [-DefinitionTimeframe ] [-DefinitionType ] + [-DestinationContainer ] [-DestinationResourceId ] [-DestinationRootFolderPath ] + [-ETag ] [-Format ] [-RecurrencePeriodFrom ] [-RecurrencePeriodTo ] + [-ScheduleRecurrence ] [-ScheduleStatus ] [-TimePeriodFrom ] + [-TimePeriodTo ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzCostManagementExport -InputObject [-ConfigurationColumn ] + [-DataSetGranularity ] [-DefinitionTimeframe ] [-DefinitionType ] + [-DestinationContainer ] [-DestinationResourceId ] [-DestinationRootFolderPath ] + [-ETag ] [-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 AzCostManagementExport by scope and name +```powershell +PS C:\> Update-AzCostManagementExport -Scope "subscriptions//*********" -Name "TestExport" -ScheduleRecurrence 'Weekly' + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfo Microsoft.CostManagement/exports +``` + +Update AzCostManagementExport by Scope and name + +### Example 2: Update AzCostManagementExport by InputObject +```powershell +PS C:\> $oldExport = Get-AzCostManagementExport -Scope "subscriptions/*********" -Name "TestExport" +Update-AzCostManagementExport -InputObject $oldExport -ScheduleRecurrence 'Weekly' + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfo Microsoft.CostManagement/exports +``` + +Update AzCostManagementExport by InputObject + +## PARAMETERS + +### -ConfigurationColumn +Array of column names to be included in the export. +If not provided then the export will include all available columns. +The available columns can vary by customer channel (see examples). + +```yaml +Type: System.String[] +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 export. +Currently only 'Daily' is supported. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType +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 export. +If custom, then a specific time period must be provided. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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 export. +Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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 +``` + +### -ETag +eTag of the resource. +To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + +```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. +Currently only 'Csv' is supported. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.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.CostManagement.Models.ICostManagementIdentity +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.CostManagement.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 export's schedule. +If 'Inactive', the export's schedule is paused. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.StatusType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + +```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 for export data. + +```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 for export data. + +```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.CostManagement.Models.ICostManagementIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20200601.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/readme.md b/src/CostManagement/docs/readme.md new file mode 100644 index 000000000000..b70ae768ed4f --- /dev/null +++ b/src/CostManagement/docs/readme.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.CostManagement` 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.CostManagement` 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..fbe3ad3dac03 --- /dev/null +++ b/src/CostManagement/examples/Get-AzCostManagementExport.md @@ -0,0 +1,24 @@ +### Example 1: Get all AzCostManagementExports by scope +```powershell +PS C:\> Get-AzCostManagementExport -Scope 'subscriptions/**********' + +ETag Name Type +---- ---- ---- +"************" TestExport Microsoft.CostManagement/exports +"************" TestExport1 Microsoft.CostManagement/exports +"************" TestExport2 Microsoft.CostManagement/exports +``` + +Get all AzCostManagementExports by Scope + +### Example 2: Get AzCostManagementExport by Name and scope +```powershell +PS C:\> Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' + +ETag Name Type +---- ---- ---- +"************" TestExport Microsoft.CostManagement/exports +``` + +Get AzCostManagementExport by Name and scope + diff --git a/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md b/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md new file mode 100644 index 000000000000..10a16ea48382 --- /dev/null +++ b/src/CostManagement/examples/Get-AzCostManagementExportExecutionHistory.md @@ -0,0 +1,25 @@ +### Example 1: Get AzCostManagementExportExecutionHistory +```powershell +PS C:\> Get-AzCostManagementExportExecutionHistory -ExportName 'TestExport' -Scope 'subscriptions/**********' + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +Scheduled 2020/6/11 12:03:20 2020/6/11 12:03:43 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +Scheduled 2020/6/12 12:03:37 2020/6/12 12:03:48 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +``` + +Get AzCostManagementExportExecutionHistory By ExportName and Scope + +### Example 2: Get AzCostManagementExportExecutionHistory by InputObject +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' +Get-AzCostManagementExportExecutionHistory -InputObject $getExport + +ExecutionType ProcessingStartTime ProcessingEndTime Status FileName +------------- ------------------- ----------------- ------ -------- +Scheduled 2020/6/11 12:03:20 2020/6/11 12:03:43 Completed ad-hoc/TestExport/20200601-20200630/TestExport_00000000-0000-0000-0000-000000000000.csv +Scheduled 2020/6/12 12:03:37 2020/6/12 12:03:48 Completed ad-hoc/TestExport/20200601-20200630/ +``` + +Get AzCostManagementExportExecutionHistory By InputObject + diff --git a/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md b/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md new file mode 100644 index 000000000000..cc22ce003f0a --- /dev/null +++ b/src/CostManagement/examples/Invoke-AzCostManagementExecuteExport.md @@ -0,0 +1,17 @@ +### Example 1: Invoke Export by ExportName and Scope +```powershell +PS C:\> Invoke-AzCostManagementExecuteExport -ExportName 'TestExport' -Scope 'subscriptions/**********' + +``` + +Invoke Export by ExportName and Scope + +### Example 2: Invoke Export by InputObject +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Name 'TestExport' -Scope 'subscriptions/**********' +Invoke-AzCostManagementExecuteExport -InputObject $getExport + +``` + +Invoke Export by InputObject + diff --git a/src/CostManagement/examples/Invoke-AzCostManagementQuery.md b/src/CostManagement/examples/Invoke-AzCostManagementQuery.md new file mode 100644 index 000000000000..ae4cf712e1b0 --- /dev/null +++ b/src/CostManagement/examples/Invoke-AzCostManagementQuery.md @@ -0,0 +1,24 @@ +### Example 1: Invoke AzCostManagementQuery by Scope +```powershell +PS C:\> Invoke-AzCostManagementQuery -Scope "/subscriptions/***********" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'Daily' + +Column Row +------ --- +{UsageDate, Currency} {20201101 USD, 20201102 USD, 20201103 USD, 20201104 USD…} +``` + +Invoke AzCostManagementQuery by Scope + +### Example 2: Invoke AzCostManagementQuery by Scope with Dimensions +```powershell +PS C:\> $dimensions = New-AzCostManagementQueryComparisonExpressionObject -Name 'ResourceGroup' -Operator 'In' -Value 'API' +$filter = New-AzCostManagementQueryFilterObject -Dimensions $dimensions +Invoke-AzCostManagementQuery -Type Usage -Scope "subscriptions/***********" -DatasetGranularity 'Monthly' -DatasetFilter $filter -Timeframe MonthToDate -Debug + + +Column Row +------ --- +{BillingMonth, Currency} {} +``` + +Invoke AzCostManagementQuery by Scope with Dimensions \ No newline at end of file diff --git a/src/CostManagement/examples/New-AzCostManagementExport.md b/src/CostManagement/examples/New-AzCostManagementExport.md new file mode 100644 index 000000000000..b93092c35902 --- /dev/null +++ b/src/CostManagement/examples/New-AzCostManagementExport.md @@ -0,0 +1,11 @@ +### Example 1: Create an AzCostManagementExport +```powershell +PS C:\> New-AzCostManagementExport -Scope "subscriptions/***********" -Name "CostManagementExportTest" -ScheduleStatus "Active" -ScheduleRecurrence "Daily" -RecurrencePeriodFrom "2020-10-31T20:00:00Z" -RecurrencePeriodTo "2020-11-30T00:00:00Z" -Format "Csv" -DestinationResourceId "/subscriptions/*************/resourceGroups/ResourceGroupTest/providers/Microsoft.Storage/storageAccounts/storageAccountTest" ` -DestinationContainer "exports" -DestinationRootFolderPath "ad-hoc" -DefinitionType "Usage" -DefinitionTimeframe "MonthToDate" -DatasetGranularity "Daily" + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfosagdhaghj Microsoft.CostManagement/exports +``` + +Create an AzCostManagementExport + 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..08f45c24370c --- /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.Api20200601.QueryComparisonExpression +Not : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter +Or : {Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter, Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.QueryFilter} +Tag : Microsoft.Azure.PowerShell.Cmdlets.Cost.Models.Api20200601.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..b913c3e4c876 --- /dev/null +++ b/src/CostManagement/examples/Remove-AzCostManagementExport.md @@ -0,0 +1,19 @@ +### Example 1: Delete the AzCostManagementExport by Scope and Name +```powershell +PS C:\> Remove-AzCostManagementExport -Scope 'subscriptions/********' -name 'TestExportDatasetAggregationInfoYouri' + + +``` + +Delete the AzCostManagementExport By Scope and ExportName + +### Example 2: Delete the AzCostManagementExport by Export Object +```powershell +PS C:\> $getExport = Get-AzCostManagementExport -Scope 'subscriptions/*********' -name 'TestExportDatasetAggregationYouori' +Remove-AzCostManagementExport -InputObject $getExport + + +``` + +Delete the AzCostManagementExport By InputObject + diff --git a/src/CostManagement/examples/Update-AzCostManagementExport.md b/src/CostManagement/examples/Update-AzCostManagementExport.md new file mode 100644 index 000000000000..48744b80912b --- /dev/null +++ b/src/CostManagement/examples/Update-AzCostManagementExport.md @@ -0,0 +1,23 @@ +### Example 1: Update AzCostManagementExport by scope and name +```powershell +PS C:\> Update-AzCostManagementExport -Scope "subscriptions//*********" -Name "TestExport" -ScheduleRecurrence 'Weekly' + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfo Microsoft.CostManagement/exports +``` + +Update AzCostManagementExport by Scope and name + +### Example 2: Update AzCostManagementExport by InputObject +```powershell +PS C:\> $oldExport = Get-AzCostManagementExport -Scope "subscriptions/*********" -Name "TestExport" +Update-AzCostManagementExport -InputObject $oldExport -ScheduleRecurrence 'Weekly' + +ETag Name Type +---- ---- ---- +"********" TestExportDatasetAggregationInfo Microsoft.CostManagement/exports +``` + +Update AzCostManagementExport by InputObject + diff --git a/src/CostManagement/how-to.md b/src/CostManagement/how-to.md new file mode 100644 index 000000000000..8ac954c6b92a --- /dev/null +++ b/src/CostManagement/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.CostManagement`. + +## Building `Az.CostManagement` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. + +## Testing `Az.CostManagement` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. + +## Packing `Az.CostManagement` +To pack `Az.CostManagement` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.CostManagement`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.CostManagement.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.CostManagement.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.CostManagement`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.CostManagement` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/CostManagement/license.txt b/src/CostManagement/license.txt new file mode 100644 index 000000000000..b9f3180fb9af --- /dev/null +++ b/src/CostManagement/license.txt @@ -0,0 +1,227 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + + +The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Provided for Informational Purposes Only + +AutoMapper + +The MIT License (MIT) +Copyright (c) 2010 Jimmy Bogard + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + +*************** + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/src/CostManagement/readme.md b/src/CostManagement/readme.md new file mode 100644 index 000000000000..ba8f2210d58a --- /dev/null +++ b/src/CostManagement/readme.md @@ -0,0 +1,197 @@ + +# Az.CostManagement +This directory contains the PowerShell module for the Cost service. + +--- +## Status +[![Az.CostManagement](https://img.shields.io/powershellgallery/v/Az.CostManagement.svg?style=flat-square&label=Az.CostManagement "Az.CostManagement")](https://www.powershellgallery.com/packages/Az.CostManagement/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.8.1 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.CostManagement`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  +## Run Generation +In this directory, run AutoRest: +> `autorest` +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +Branch: 2cb80cf6668074c84cf02cf45b6bb897eff47e9b +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2020-06-01/costmanagement.json + - $(repo)/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2020-06-01/costmanagement.exports.json +title: CostManagement +module-version: 0.1.0 + +service-name: CostManagement + +identity-correction-for-post: true + +directive: + - where: + variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$ + remove: true + - from: source-file-csharp + where: $ + transform: $ = $.replace(/AlertCategory System/, 'AlertCategory System1'); + - from: source-file-csharp + where: $ + transform: $ = $.replace(/internal partial interface/, 'public partial interface'); + - where: + verb: Set + set: + verb: Update + - where: + subject: UsageQuery + verb: invoke + remove: true + - where: + subject: ByDimensionExternalCloudProviderType|CloudForecast|DismissAlert|Forecast + verb: Invoke + remove: true + - where: + subject: Export|ExportExecutionHistory|ExportExecution + parameter-name: Scope + set: + parameter-name: Scope + parameter-description: This parameter defines the scope of costmanagement from different perspectives 'Subscription','ResourceGroup' and 'Provide Service'. + - where: + subject: Export + verb: New + hide: true + - where: + subject: Export + verb: Update + hide: true + - from: source-file-csharp + where: $ + transform: $ = $.replace(/\/runHistory\$/g, "$"); + - where: + subject: Alert|AlertExternal|Dimension|View + remove: true + - from: source-file-csharp + where: $ + transform: $ = $.replace(/\^\/\(\?\[\^\/\]\+\)/g, "(?.+)"); + - where: + model-name: QueryResult + set: + format-table: + properties: + - NextLink + - Column + - Row + - where: + model-name: ExportExecution + set: + format-table: + properties: + - ExecutionType + - ProcessingStartTime + - ProcessingEndTime + - RunSetting + - Status + - FileName + - from: swagger-document + where: $.definitions.AlertProperties.properties.details.properties.resourceGroupFilter.items + transform: >- + return { + "type": "string" + } + - from: swagger-document + where: $.definitions.AlertProperties.properties.details.properties.resourceFilter.items + transform: >- + return { + "type": "string" + } + - from: swagger-document + where: $.definitions.AlertProperties.properties.details.properties.meterFilter.items + transform: >- + return { + "type": "string" + } + - from: swagger-document + where: $.definitions.QueryProperties.properties.rows.items.items + transform: >- + return { + "type": "string" + } + - from: swagger-document + where: $.definitions.QueryFilter.properties + transform: >- + return { + "and": { + "description": "The logical \"AND\" expression. Must have at least 2 items.", + "type": "array", + "items": { + "$ref": "#/definitions/QueryFilter" + }, + "minItems": 2 + }, + "or": { + "description": "The logical \"OR\" expression. Must have at least 2 items.", + "type": "array", + "items": { + "$ref": "#/definitions/QueryFilter" + }, + "minItems": 2 + }, + "not": { + "description": "The logical \"NOT\" expression.", + "$ref": "#/definitions/QueryFilter" + }, + "dimensions": { + "description": "Has comparison expression for a dimension", + "$ref": "#/definitions/QueryComparisonExpression" + }, + "tag": { + "description": "Has comparison expression for a tag", + "$ref": "#/definitions/QueryComparisonExpression" + } + } + - where: + model-name: QueryFilter + property-name: Dimension + set: + property-name: Dimensions + - where: + model-name: QueryResult + set: + format-table: + properties: + - Column + - Row + - no-inline: + - QueryFilter + - ReportConfigFilter +``` diff --git a/src/CostManagement/resources/readme.md b/src/CostManagement/resources/readme.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/src/CostManagement/resources/readme.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ 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..18018b228439 --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExport.Recording.json @@ -0,0 +1,170 @@ +{ + "Get-AzCostManagementExport+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "019f78ea-6d5d-4526-96b6-759794f5b56e" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "7c853323-98ff-444b-8cf2-ff9e08faef47" ], + "x-ms-request-id": [ "1d220c16-222c-493d-ba84-78097dee9e30" ], + "x-ms-correlation-request-id": [ "e86dfb49-a45f-4671-9088-43db287b2aa2" ], + "x-ms-client-request-id": [ "019f78ea-6d5d-4526-96b6-759794f5b56e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T070127Z:e86dfb49-a45f-4671-9088-43db287b2aa2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:01:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "30290" ], + "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/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/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\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation123\",\"name\":\"TestExportDatasetAggregation123\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b19fb5559127\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-03T20:00:00+00:00\",\"to\":\"2020-11-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/TestExportDatasetAggregationInfoyouri\",\"name\":\"TestExportDatasetAggregationInfoyouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b33c18099a67\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-05T20:00:00+00:00\",\"to\":\"2020-11-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\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestUpdate1\",\"name\":\"TestUpdate1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b6451f8f6d83\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-09T20:00:00+00:00\",\"to\":\"2020-11-20T00:00:00+00:00\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:26.9366552Z\",\"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/TestExportDatasetAggregationInfoYouri\",\"name\":\"TestExportDatasetAggregationInfoYouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b738f9459e9e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-13T20:00:00Z\",\"to\":\"2020-11-17T00:00:00Z\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"adhoctest\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationYouriTest\",\"name\":\"TestExportDatasetAggregationYouriTest\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b7120d0af53a\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-10T20:00:00+00:00\",\"to\":\"2020-11-15T00: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\":\"adhoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationInfo1118\",\"name\":\"TestExportDatasetAggregationInfo1118\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd716961a536\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T20:00:00Z\",\"to\":\"2020-11-20T00:00:00Z\"}},\"nextRunTimeEstimate\":\"2020-11-18T20:00:00Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/youri-costmanagement/providers/Microsoft.Storage/storageAccounts/youristorageaccount\",\"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-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd74b260689e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:26.9366552Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-x9d0hl\",\"name\":\"export-x9d0hl\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd787c7e5e56\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:26.9366552Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-9pcvod\",\"name\":\"export-9pcvod\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd787f0fd3c0\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:26.9366552Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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\"}}}}]}" + } + }, + "Get-AzCostManagementExport+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "284728a8-bc91-4a3a-8713-f71c14f4756f" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "0e2f0ad0-a2c2-4128-bf1e-790e4a6b93c9" ], + "x-ms-request-id": [ "c3b28262-7f15-4fb0-b212-893bcda8d57d" ], + "x-ms-correlation-request-id": [ "1f4c0526-984b-47b4-849d-0dc455f20959" ], + "x-ms-client-request-id": [ "284728a8-bc91-4a3a-8713-f71c14f4756f" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T070127Z:1f4c0526-984b-47b4-849d-0dc455f20959" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:01:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "762" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd74b260689e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:27.7260468Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "dd33ad9d-1784-4051-b058-dc7f19937624" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "694c1cdd-5000-4a20-a214-06f160bb22a4" ], + "x-ms-request-id": [ "abbabf4c-1d8a-4caf-bcce-c41d246a3cf7" ], + "x-ms-correlation-request-id": [ "5ff3f209-9582-4551-94da-8a039ea7bb9a" ], + "x-ms-client-request-id": [ "dd33ad9d-1784-4051-b058-dc7f19937624" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T070128Z:5ff3f209-9582-4551-94da-8a039ea7bb9a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:01:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "762" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd74b260689e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:28.3543878Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-oenfxg?api-version=2020-06-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "9aa28b62-5456-4ae9-84cf-3998beb992fd" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "f2825f60-8a64-4405-a1e5-9603815df2c7" ], + "x-ms-request-id": [ "66093be2-1093-45ca-9b47-7170ddb604d0" ], + "x-ms-correlation-request-id": [ "73507b6e-2ae5-462a-95c6-921ff56f9532" ], + "x-ms-client-request-id": [ "9aa28b62-5456-4ae9-84cf-3998beb992fd" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T070129Z:73507b6e-2ae5-462a-95c6-921ff56f9532" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:01:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "762" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd74b260689e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:01:28.9611203Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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..498de3ec2549 --- /dev/null +++ b/src/CostManagement/test/Get-AzCostManagementExportExecutionHistory.Recording.json @@ -0,0 +1,128 @@ +{ + "Get-AzCostManagementExportExecutionHistory+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/runHistory?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/runHistory?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "23f11f1f-f46b-4cc0-911e-8f4ec0cdfead" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "a6606686-60eb-4a95-8652-8541b8a9878e" ], + "x-ms-request-id": [ "4cec0d72-ab40-4629-aba4-55028d98a4ca" ], + "x-ms-correlation-request-id": [ "e71587b4-1863-4b23-849e-346466f86590" ], + "x-ms-client-request-id": [ "23f11f1f-f46b-4cc0-911e-8f4ec0cdfead" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072513Z:e71587b4-1863-4b23-849e-346466f86590" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:25:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1856" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/46fcbcd5-e265-4d3d-b64d-29730797d629\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:47.826442Z\",\"processingStartTime\":\"2020-11-18T07:23:49.9336163Z\",\"processingEndTime\":\"2020-11-18T07:24:34.1615162Z\",\"fileName\":\"ad-hoc/export-oenfxg/20201101-20201130/export-oenfxg_46fcbcd5-e265-4d3d-b64d-29730797d629.csv\"}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/7bc55aa1-73c7-4817-a792-a5d18f16c30b\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:51.0272403Z\",\"processingStartTime\":\"2020-11-18T07:23:53.0245821Z\",\"processingEndTime\":\"2020-11-18T07:24:25.01233Z\",\"fileName\":\"ad-hoc/export-oenfxg/20201101-20201130/export-oenfxg_7bc55aa1-73c7-4817-a792-a5d18f16c30b.csv\"}}]}" + } + }, + "Get-AzCostManagementExportExecutionHistory+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "73a50aa7-ed60-4a71-ab9e-3db97e2355e2" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "b9a804c4-5c5e-4270-bdd9-7ee7b70bbdcf" ], + "x-ms-request-id": [ "2ab7588d-c1dc-41c0-a957-75c6c3797d85" ], + "x-ms-correlation-request-id": [ "9900b0be-b85b-4772-a73d-ff9336d142ec" ], + "x-ms-client-request-id": [ "73a50aa7-ed60-4a71-ab9e-3db97e2355e2" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072513Z:9900b0be-b85b-4772-a73d-ff9336d142ec" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:25:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "762" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7bacc71476\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:25:13.5620095Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-oenfxg/runHistory?api-version=2020-06-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/runHistory?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "29fa47d9-86e7-466f-b5f0-0dcf1901cf4e" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "8ecb35b7-2d7b-4c0a-bd8d-8cf0a0752340" ], + "x-ms-request-id": [ "ba2e7d02-8d12-4551-b694-5311269b1512" ], + "x-ms-correlation-request-id": [ "dd87d05f-f740-4a4a-b4b2-8768f03ace3b" ], + "x-ms-client-request-id": [ "29fa47d9-86e7-466f-b5f0-0dcf1901cf4e" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072514Z:dd87d05f-f740-4a4a-b4b2-8768f03ace3b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:25:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1856" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/46fcbcd5-e265-4d3d-b64d-29730797d629\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:47.826442Z\",\"processingStartTime\":\"2020-11-18T07:23:49.9336163Z\",\"processingEndTime\":\"2020-11-18T07:24:34.1615162Z\",\"fileName\":\"ad-hoc/export-oenfxg/20201101-20201130/export-oenfxg_46fcbcd5-e265-4d3d-b64d-29730797d629.csv\"}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/7bc55aa1-73c7-4817-a792-a5d18f16c30b\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"Completed\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:51.0272403Z\",\"processingStartTime\":\"2020-11-18T07:23:53.0245821Z\",\"processingEndTime\":\"2020-11-18T07:24:25.01233Z\",\"fileName\":\"ad-hoc/export-oenfxg/20201101-20201130/export-oenfxg_7bc55aa1-73c7-4817-a792-a5d18f16c30b.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..a1372bb46ed9 --- /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 2 + } + + It 'GetViaIdentity' { + $export = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $exportHist = Get-AzCostManagementExportExecutionHistory -InputObject $export + $exportHist.Count | Should -Be 2 + } +} diff --git a/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json new file mode 100644 index 000000000000..bd7c5dfe8da8 --- /dev/null +++ b/src/CostManagement/test/Invoke-AzCostManagementExecuteExport.Recording.json @@ -0,0 +1,208 @@ +{ + "Invoke-AzCostManagementExecuteExport+[NoContext]+Execute+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/run?api-version=2020-06-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/run?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "15e9cb13-90d9-4709-9bf8-cc6424b3fadf" ], + "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": [ "18bb1119-00da-487a-a5f9-258893d7546a" ], + "x-ms-request-id": [ "cd99ca74-4db5-492d-b7f6-d80d0b9a3c58" ], + "x-ms-correlation-request-id": [ "9cc9ce6b-f352-4366-a410-bf9f9584ed74" ], + "x-ms-client-request-id": [ "15e9cb13-90d9-4709-9bf8-cc6424b3fadf" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072349Z:9cc9ce6b-f352-4366-a410-bf9f9584ed74" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:23:49 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-oenfxg/runHistory?api-version=2020-06-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/runHistory?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "7a53a0f6-4051-4e48-a4ba-57d93a2e2f58" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "c9c9317e-b541-4389-8544-723601ab9332" ], + "x-ms-request-id": [ "ece4d240-3a16-45a4-9307-e42063bc0e4c" ], + "x-ms-correlation-request-id": [ "d059e713-a14e-4436-8cd8-e79cc17e76b2" ], + "x-ms-client-request-id": [ "7a53a0f6-4051-4e48-a4ba-57d93a2e2f58" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072350Z:d059e713-a14e-4436-8cd8-e79cc17e76b2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:23:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "792" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/46fcbcd5-e265-4d3d-b64d-29730797d629\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:47.826442Z\",\"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-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "ce57afeb-eac4-49cd-b790-634e2673251c" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "671aad90-703f-4db9-8b30-0526507ab6b0" ], + "x-ms-request-id": [ "107d74b6-4d7f-4511-bb72-4720738bad95" ], + "x-ms-correlation-request-id": [ "909eb4c7-2f3b-44db-88b8-5b01e8a20325" ], + "x-ms-client-request-id": [ "ce57afeb-eac4-49cd-b790-634e2673251c" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072350Z:909eb4c7-2f3b-44db-88b8-5b01e8a20325" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:23:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "762" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7bacc71476\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:23:50.5429086Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-oenfxg/run?api-version=2020-06-01+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/run?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "f7c1b42e-c314-4937-be4a-799dd5264710" ], + "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": [ "ba6dab3b-0775-4f70-9021-191d85b545d5" ], + "x-ms-request-id": [ "3d1f28d9-7c93-4ec9-ab82-e8a57f635bc2" ], + "x-ms-correlation-request-id": [ "70513666-265d-488e-a505-fd31c0ba4a75" ], + "x-ms-client-request-id": [ "f7c1b42e-c314-4937-be4a-799dd5264710" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072352Z:70513666-265d-488e-a505-fd31c0ba4a75" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:23:52 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-oenfxg/runHistory?api-version=2020-06-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/runHistory?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "035e700a-9b02-413e-9ebb-8d2e63725211" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "11ce37cf-b54f-4c7f-b528-5f1cd891bc42" ], + "x-ms-request-id": [ "c0e28c10-573a-4570-873c-8e1f2ebf5ca3" ], + "x-ms-correlation-request-id": [ "f4e04a41-f1c7-447e-8203-999c70d91ba0" ], + "x-ms-client-request-id": [ "035e700a-9b02-413e-9ebb-8d2e63725211" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072353Z:f4e04a41-f1c7-447e-8203-999c70d91ba0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:23:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1574" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/46fcbcd5-e265-4d3d-b64d-29730797d629\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:47.826442Z\",\"processingStartTime\":null,\"processingEndTime\":null,\"fileName\":null}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg/Run/7bc55aa1-73c7-4817-a792-a5d18f16c30b\",\"name\":null,\"type\":null,\"eTag\":null,\"properties\":{\"runSettings\":{\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}},\"executionType\":\"OnDemand\",\"status\":\"InProgress\",\"submittedBy\":\"v-lipyo@microsoft.com\",\"submittedTime\":\"2020-11-18T07:23:51.0272403Z\",\"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..7c61a505d6d4 --- /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 1 + } + + 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 2 + } +} diff --git a/src/CostManagement/test/Invoke-AzCostManagementQuery.Tests.ps1 b/src/CostManagement/test/Invoke-AzCostManagementQuery.Tests.ps1 new file mode 100644 index 000000000000..9a9071335ebf --- /dev/null +++ b/src/CostManagement/test/Invoke-AzCostManagementQuery.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 'Invoke-AzCostManagementQuery.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-AzCostManagementQuery' { + It 'UsageExpanded' -skip { + $invbokeQueryResult = Invoke-AzCostManagementQuery -Scope "/subscriptions/$($env.SubscriptionId)" -Timeframe MonthToDate -Type Usage -DatasetGranularity 'Daily' + $invbokeQueryResult.Column.Name.Contains('UsageDate') | Should -Be $true + } + + # It 'UsageExpanded1' -skip { + # #$DimensionObject = new-AzCostManagementQueryComparisonExpressionObject -name 'ResourceGroup' -Operator 'In' -Value 'API' + # #$FilterObject = New-AzCostManagementQueryFilterObject -Dimension $DimensionObject + # #Invoke-AzCostManagementQuery -ExternalCloudProviderId 'Microsoft.Compute' -ExternalCloudProviderType externalBillingAccounts -Timeframe MonthToDate -type Usage -DatasetFilter $FilterObject -DatasetGranularity Daily -debug + # } +} diff --git a/src/CostManagement/test/New-AzCostManagementExport.Recording.json b/src/CostManagement/test/New-AzCostManagementExport.Recording.json new file mode 100644 index 000000000000..7344ac5256fe --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementExport.Recording.json @@ -0,0 +1,113 @@ +{ + "New-AzCostManagementExport+[NoContext]+CreateExpandedBySubscription+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-x9d0hl?api-version=2020-06-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-x9d0hl?api-version=2020-06-01", + "Content": "{\r\n \"properties\": {\r\n \"definition\": {\r\n \"dataSet\": {\r\n \"granularity\": \"Daily\"\r\n },\r\n \"type\": \"Usage\",\r\n \"timeframe\": \"MonthToDate\"\r\n },\r\n \"deliveryInfo\": {\r\n \"destination\": {\r\n \"container\": \"exports\",\r\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\r\n \"rootFolderPath\": \"ad-hoc\"\r\n }\r\n },\r\n \"format\": \"Csv\",\r\n \"schedule\": {\r\n \"recurrencePeriod\": {\r\n \"from\": \"2020-11-18T14:33:13.0000000\",\r\n \"to\": \"2020-12-08T14:33:13.0000000\"\r\n },\r\n \"recurrence\": \"Daily\",\r\n \"status\": \"Active\"\r\n }\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "726" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://costmanagement.trafficmanager.net/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-x9d0hl?api-version=2020-06-01" ], + "session-id": [ "7fcf2ee1-0f52-454b-b52b-c9035a39628e" ], + "x-ms-request-id": [ "a0551e42-d111-48c0-998f-a6aa754c5b30" ], + "x-ms-correlation-request-id": [ "5b87b8d1-a9dd-45e0-ba16-357f8ace82e8" ], + "x-ms-client-request-id": [ "9d4cf527-ae8c-4766-ae7c-d4e152715595" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T071141Z:5b87b8d1-a9dd-45e0-ba16-357f8ace82e8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:11:40 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-x9d0hl\",\"name\":\"export-x9d0hl\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7a0ff53443\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01", + "Content": "{\r\n \"properties\": {\r\n \"definition\": {\r\n \"dataSet\": {\r\n \"granularity\": \"Daily\"\r\n },\r\n \"type\": \"Usage\",\r\n \"timeframe\": \"MonthToDate\"\r\n },\r\n \"deliveryInfo\": {\r\n \"destination\": {\r\n \"container\": \"exports\",\r\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\r\n \"rootFolderPath\": \"ad-hoc\"\r\n }\r\n },\r\n \"format\": \"Csv\",\r\n \"schedule\": {\r\n \"recurrencePeriod\": {\r\n \"from\": \"2020-11-18T14:33:13.0000000\",\r\n \"to\": \"2020-12-08T14:33:13.0000000\"\r\n },\r\n \"recurrence\": \"Daily\",\r\n \"status\": \"Active\"\r\n }\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "726" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://costmanagement.trafficmanager.net/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01" ], + "session-id": [ "c227ef88-20fa-4121-a349-3d15e333a802" ], + "x-ms-request-id": [ "31026004-c411-488d-9b5c-520f6ea480c4" ], + "x-ms-correlation-request-id": [ "7d35ff32-a6b6-41a1-9e8f-d596601c6f87" ], + "x-ms-client-request-id": [ "65950298-7073-4406-985e-bfd3f4f6222b" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T071142Z:7d35ff32-a6b6-41a1-9e8f-d596601c6f87" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:11:42 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-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx\",\"name\":\"export-d9y6fx\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7a10dd6183\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-9pcvod?api-version=2020-06-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-9pcvod?api-version=2020-06-01", + "Content": "{\r\n \"properties\": {\r\n \"definition\": {\r\n \"dataSet\": {\r\n \"configuration\": {\r\n \"columns\": [ \"SubscriptionGuid\", \"MeterId\", \"InstanceId\", \"ResourceGroup\", \"PreTaxCost\" ]\r\n },\r\n \"granularity\": \"Daily\"\r\n },\r\n \"type\": \"Usage\",\r\n \"timeframe\": \"MonthToDate\"\r\n },\r\n \"deliveryInfo\": {\r\n \"destination\": {\r\n \"container\": \"exports\",\r\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\r\n \"rootFolderPath\": \"ad-hoc\"\r\n }\r\n },\r\n \"format\": \"Csv\",\r\n \"schedule\": {\r\n \"recurrencePeriod\": {\r\n \"from\": \"2020-11-18T14:33:13.0000000\",\r\n \"to\": \"2020-12-08T14:33:13.0000000\"\r\n },\r\n \"recurrence\": \"Daily\",\r\n \"status\": \"Active\"\r\n }\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "867" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://costmanagement.trafficmanager.net/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-9pcvod?api-version=2020-06-01" ], + "session-id": [ "660240c4-6608-4f6e-ac0c-a0d78f49ae3b" ], + "x-ms-request-id": [ "84d4cc5c-9777-48a8-a6fe-6db8e5dce8f4" ], + "x-ms-correlation-request-id": [ "fe40597b-cc97-4013-9e8b-95cd37deb749" ], + "x-ms-client-request-id": [ "fe5b590a-e8af-418d-8232-64a0cb4296dc" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T071144Z:fe40597b-cc97-4013-9e8b-95cd37deb749" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:11:44 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-9pcvod\",\"name\":\"export-9pcvod\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7a11bbd2e1\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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\"}}}}" + } + } +} \ 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..0639a66da637 --- /dev/null +++ b/src/CostManagement/test/New-AzCostManagementExport.Tests.ps1 @@ -0,0 +1,48 @@ +$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' + } +} 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..e09c6f0a7d8d --- /dev/null +++ b/src/CostManagement/test/Remove-AzCostManagementExport.Recording.json @@ -0,0 +1,208 @@ +{ + "Remove-AzCostManagementExport+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-9pcvod?api-version=2020-06-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-9pcvod?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "6097a897-2c94-429f-8141-37ae62564a81" ], + "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": [ "99243537-446c-4223-9978-a16597ccc6d1" ], + "x-ms-request-id": [ "adc0e498-627d-4c73-838a-058a536b1dda" ], + "x-ms-correlation-request-id": [ "23aabe0d-4966-4ba4-9fa3-3923e00db19b" ], + "x-ms-client-request-id": [ "6097a897-2c94-429f-8141-37ae62564a81" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11975" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T073529Z:23aabe0d-4966-4ba4-9fa3-3923e00db19b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:35:29 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=2020-06-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "b6609d7f-cc26-46f8-acc3-706cf8c14f75" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "2603e8e7-9c1f-45dd-8187-52fd56799721" ], + "x-ms-request-id": [ "4a915377-e40e-4eae-b685-7cac25c37ae0" ], + "x-ms-correlation-request-id": [ "569bbca1-8fbb-477c-a491-3f8030fcf711" ], + "x-ms-client-request-id": [ "b6609d7f-cc26-46f8-acc3-706cf8c14f75" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T073530Z:569bbca1-8fbb-477c-a491-3f8030fcf711" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:35:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "28664" ], + "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/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/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\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation123\",\"name\":\"TestExportDatasetAggregation123\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b19fb5559127\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-03T20:00:00+00:00\",\"to\":\"2020-11-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/TestExportDatasetAggregationInfoyouri\",\"name\":\"TestExportDatasetAggregationInfoyouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b33c18099a67\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-05T20:00:00+00:00\",\"to\":\"2020-11-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\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestUpdate1\",\"name\":\"TestUpdate1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b6451f8f6d83\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-09T20:00:00+00:00\",\"to\":\"2020-11-20T00:00:00+00:00\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:35:30.5064286Z\",\"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/TestExportDatasetAggregationInfoYouri\",\"name\":\"TestExportDatasetAggregationInfoYouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b738f9459e9e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-13T20:00:00Z\",\"to\":\"2020-11-17T00:00:00Z\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"adhoctest\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationYouriTest\",\"name\":\"TestExportDatasetAggregationYouriTest\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b7120d0af53a\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-10T20:00:00+00:00\",\"to\":\"2020-11-15T00: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\":\"adhoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationInfo1118\",\"name\":\"TestExportDatasetAggregationInfo1118\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd716961a536\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T20:00:00Z\",\"to\":\"2020-11-20T00:00:00Z\"}},\"nextRunTimeEstimate\":\"2020-11-18T20:00:00Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/youri-costmanagement/providers/Microsoft.Storage/storageAccounts/youristorageaccount\",\"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-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7c8581cbbf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:35:30.5220541Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}]}" + } + }, + "Remove-AzCostManagementExport+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "10b92aec-4d02-4c03-af0a-8852b2fef666" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "deabb3f6-02e7-4184-bbe7-7fc205c6281d" ], + "x-ms-request-id": [ "3467ee37-b4f1-4604-bcbf-72ab1497be1f" ], + "x-ms-correlation-request-id": [ "e4a855da-7c4d-4858-89ad-55ad09bc6263" ], + "x-ms-client-request-id": [ "10b92aec-4d02-4c03-af0a-8852b2fef666" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11973" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T073531Z:e4a855da-7c4d-4858-89ad-55ad09bc6263" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:35:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "802" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx\",\"name\":\"export-d9y6fx\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7a10dd6183\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-18T14:33:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:35:31.3085144Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.CostManagement/exports/export-d9y6fx?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "cd8e6c2d-1fb8-4bd1-b055-e389684293f3" ], + "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": [ "3eb9af18-dfff-4861-b606-939129db2f00" ], + "x-ms-request-id": [ "1f69fc51-e1b8-43b5-a7b4-388189b4ae20" ], + "x-ms-correlation-request-id": [ "9e8153c4-0d85-4985-9bac-09254669d89f" ], + "x-ms-client-request-id": [ "cd8e6c2d-1fb8-4bd1-b055-e389684293f3" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11972" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T073532Z:9e8153c4-0d85-4985-9bac-09254669d89f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:35:31 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=2020-06-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "9cc2bac3-42f9-4cd5-9936-046b57c87b48" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "b52ad8b7-3728-4f34-bfab-4d8a2c02409a" ], + "x-ms-request-id": [ "063076f8-77ac-43b8-9e38-d2fd07c1c346" ], + "x-ms-correlation-request-id": [ "eb6279ca-18d3-431c-91e4-0bca44a68271" ], + "x-ms-client-request-id": [ "9cc2bac3-42f9-4cd5-9936-046b57c87b48" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11971" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T073533Z:eb6279ca-18d3-431c-91e4-0bca44a68271" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:35:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "28664" ], + "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/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/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\"}]}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregation123\",\"name\":\"TestExportDatasetAggregation123\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b19fb5559127\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-03T20:00:00+00:00\",\"to\":\"2020-11-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/TestExportDatasetAggregationInfoyouri\",\"name\":\"TestExportDatasetAggregationInfoyouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b33c18099a67\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-05T20:00:00+00:00\",\"to\":\"2020-11-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\":{\"configuration\":{\"columns\":[\"SubscriptionGuid\",\"MeterId\",\"InstanceId\",\"ResourceGroup\",\"PreTaxCost\"]},\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestUpdate1\",\"name\":\"TestUpdate1\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b6451f8f6d83\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-09T20:00:00+00:00\",\"to\":\"2020-11-20T00:00:00+00:00\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:35:32.9300902Z\",\"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/TestExportDatasetAggregationInfoYouri\",\"name\":\"TestExportDatasetAggregationInfoYouri\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b738f9459e9e\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-13T20:00:00Z\",\"to\":\"2020-11-17T00:00:00Z\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-costmanagement/providers/Microsoft.Storage/storageAccounts/wyunchistorageaccount\",\"container\":\"exports\",\"rootFolderPath\":\"adhoctest\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationYouriTest\",\"name\":\"TestExportDatasetAggregationYouriTest\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6b7120d0af53a\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Daily\",\"recurrencePeriod\":{\"from\":\"2020-11-10T20:00:00+00:00\",\"to\":\"2020-11-15T00: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\":\"adhoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/TestExportDatasetAggregationInfo1118\",\"name\":\"TestExportDatasetAggregationInfo1118\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd716961a536\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T20:00:00Z\",\"to\":\"2020-11-20T00:00:00Z\"}},\"nextRunTimeEstimate\":\"2020-11-18T20:00:00Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/youri-costmanagement/providers/Microsoft.Storage/storageAccounts/youristorageaccount\",\"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-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7c8581cbbf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:35:32.9300902Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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/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.Recording.json b/src/CostManagement/test/Update-AzCostManagementExport.Recording.json new file mode 100644 index 000000000000..6a9283b3031f --- /dev/null +++ b/src/CostManagement/test/Update-AzCostManagementExport.Recording.json @@ -0,0 +1,118 @@ +{ + "Update-AzCostManagementExport+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": "{\r\n \"eTag\": \"\\\"1d6bd7c6fb60904\\\"\",\r\n \"properties\": {\r\n \"definition\": {\r\n \"dataSet\": {\r\n \"granularity\": \"Daily\"\r\n },\r\n \"type\": \"Usage\",\r\n \"timeframe\": \"MonthToDate\"\r\n },\r\n \"deliveryInfo\": {\r\n \"destination\": {\r\n \"container\": \"exports\",\r\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\r\n \"rootFolderPath\": \"ad-hoc\"\r\n }\r\n },\r\n \"format\": \"Csv\",\r\n \"schedule\": {\r\n \"recurrencePeriod\": {\r\n \"from\": \"2020-11-18T15:18:13.0000000\",\r\n \"to\": \"2020-12-08T14:33:13.0000000\"\r\n },\r\n \"recurrence\": \"Weekly\",\r\n \"status\": \"Active\"\r\n }\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "761" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "116036c7-5f25-4e8e-98ac-3ba7e661fdc4" ], + "x-ms-request-id": [ "a5913571-3cb3-46f3-a505-cf72a401720b" ], + "x-ms-correlation-request-id": [ "163c4040-64b6-475d-9caf-48f600889e60" ], + "x-ms-client-request-id": [ "d2d4120a-6b1d-4266-819b-7c1dc1c025dd" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072914Z:163c4040-64b6-475d-9caf-48f600889e60" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:29:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "710" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7c83a38ed5\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Update-AzCostManagementExport+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "0443d1b0-ce55-4ad5-9dd9-50f92cfe3abf" ], + "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" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "761b8792-51a0-44aa-95a9-a79a1a0173c8" ], + "x-ms-request-id": [ "94adf3d4-cda2-47d6-ab6d-30c068dde8c3" ], + "x-ms-correlation-request-id": [ "3ac7c6e2-d839-4eff-9913-13c7dd8698ee" ], + "x-ms-client-request-id": [ "0443d1b0-ce55-4ad5-9dd9-50f92cfe3abf" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072915Z:3ac7c6e2-d839-4eff-9913-13c7dd8698ee" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:29:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "763" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7c83a38ed5\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"nextRunTimeEstimate\":\"2020-11-18T19:29:15.0750135Z\",\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\"container\":\"exports\",\"rootFolderPath\":\"ad-hoc\"}},\"definition\":{\"type\":\"Usage\",\"timeframe\":\"MonthToDate\",\"dataSet\":{\"granularity\":\"Daily\"}}}}" + } + }, + "Update-AzCostManagementExport+[NoContext]+UpdateViaIdentityExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg?api-version=2020-06-01", + "Content": "{\r\n \"eTag\": \"\\\"1d6bd7c83a38ed5\\\"\",\r\n \"properties\": {\r\n \"definition\": {\r\n \"dataSet\": {\r\n \"granularity\": \"Daily\"\r\n },\r\n \"type\": \"Usage\",\r\n \"timeframe\": \"MonthToDate\"\r\n },\r\n \"deliveryInfo\": {\r\n \"destination\": {\r\n \"container\": \"exports\",\r\n \"resourceId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu\",\r\n \"rootFolderPath\": \"ad-hoc\"\r\n }\r\n },\r\n \"format\": \"Csv\",\r\n \"schedule\": {\r\n \"recurrencePeriod\": {\r\n \"from\": \"2020-11-18T15:18:13.0000000\",\r\n \"to\": \"2020-12-08T14:33:13.0000000\"\r\n },\r\n \"recurrence\": \"Weekly\",\r\n \"status\": \"Active\"\r\n }\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "761" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Vary": [ "Accept-Encoding" ], + "session-id": [ "85a03a0d-e76d-403a-b051-36de6304db05" ], + "x-ms-request-id": [ "ecf0b256-3026-49ce-80f4-3a955e62465a" ], + "x-ms-correlation-request-id": [ "cefe2cf0-cc0e-40d8-bc11-138b5bd10a1a" ], + "x-ms-client-request-id": [ "1bcc7462-a6cf-407a-a6d6-65cb3c0020bf" ], + "X-Powered-By": [ "ASP.NET" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20201118T072917Z:cefe2cf0-cc0e-40d8-bc11-138b5bd10a1a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 18 Nov 2020 07:29:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "710" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.CostManagement/exports/export-oenfxg\",\"name\":\"export-oenfxg\",\"type\":\"Microsoft.CostManagement/exports\",\"eTag\":\"\\\"1d6bd7c8581cbbf\\\"\",\"properties\":{\"schedule\":{\"status\":\"Active\",\"recurrence\":\"Weekly\",\"recurrencePeriod\":{\"from\":\"2020-11-18T15:18:13\",\"to\":\"2020-12-08T14:33:13\"}},\"format\":\"Csv\",\"deliveryInfo\":{\"destination\":{\"resourceId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/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/Update-AzCostManagementExport.Tests.ps1 b/src/CostManagement/test/Update-AzCostManagementExport.Tests.ps1 new file mode 100644 index 000000000000..22a037e9d0f3 --- /dev/null +++ b/src/CostManagement/test/Update-AzCostManagementExport.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 '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' { + $export = Update-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 -ScheduleRecurrence 'Weekly' + $export.property.ScheduleRecurrence | Should -Be 'Weekly' + } + + It 'UpdateViaIdentityExpanded' { + $oldExport = Get-AzCostManagementExport -Scope "subscriptions/$($env.SubscriptionId)" -Name $env.exportName01 + $export = Update-AzCostManagementExport -InputObject $oldExport -ScheduleRecurrence 'Weekly' + $export.property.ScheduleRecurrence | Should -Be 'Weekly' + } +} 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..d1f91363faa7 --- /dev/null +++ b/src/CostManagement/test/env.json @@ -0,0 +1,13 @@ +{ + "exportName03": "export-d9y6fx", + "storageAccountId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/costmanagement-rg-gali06/providers/Microsoft.Storage/storageAccounts/staaccountjshubiu", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "exportName04": "export-9pcvod", + "fromDate": "2020/11/18 14:33:13", + "resourceGroup": "costmanagement-rg-gali06", + "toDate": "2020/12/8 14:33:13", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "exportName02": "export-x9d0hl", + "location": "eastus", + "exportName01": "export-oenfxg" +} 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..7c752b4c8c43 --- /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..9af824ea60d7 --- /dev/null +++ b/src/CostManagement/test/utils.ps1 @@ -0,0 +1,86 @@ +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) + + $null = $env.Add('exportName01', $exportName01) + $null = $env.Add('exportName02', $exportName02) + $null = $env.Add('exportName03', $exportName03) + $null = $env.Add('exportName04', $exportName04) + + 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() + #Create One CostManagementExport + 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 +} +