Closed DevonK3 closed 2 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ms-premp.
Author: | DevonK3 |
---|---|
Assignees: | - |
Labels: | `Consumption`, `Service Attention`, `question`, `customer-reported`, `needs-triage`, `Consumption-Budget` |
Milestone: | - |
@DevonK3 , please share the debug log after setting $DebugPreference = "Continue"
. I suspect it is related to API version or logged in user's permission.
The query shows two (2) budgets, but there are actually three (3) that you can see in the Azure Portal.
PS /Users/devonkelly/Documents/GitHub/AAInternal/DEA-Epsilon/rgbudgets> $rgcb = Get-AzConsumptionBudget -ResourceGroupName $rgn
DEBUG: 10:20:21 AM - GetAzureRmConsumptionBudget begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 10:20:21 AM - using account id '2a88cf98-ae31-4acf-9c09-56a365e86244'...
DEBUG: [Common.Authentication]: Authenticating using Account: '2a88cf98-ae31-4acf-9c09-56a365e86244', environment: 'AzureCloud', tenant: '49793faf-eb3f-4d99-a0cf-aef7cce79dc1'
DEBUG: 10:20:21 AM - [ServicePrincipalAuthenticator] Calling ClientSecretCredential.GetTokenAsync - ApplicationId:'2a88cf98-ae31-4acf-9c09-56a365e86244', TenantId:'49793faf-eb3f-4d99-a0cf-aef7cce79dc1', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/'
DEBUG: ClientSecretCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: Request [04de6e7b-3d5d-4fd2-9611-ffa7e4ba10a2] POST https://login.microsoftonline.com/49793faf-eb3f-4d99-a0cf-aef7cce79dc1/oauth2/v2.0/token
x-client-SKU:REDACTED
x-client-Ver:REDACTED
x-client-OS:REDACTED
x-client-current-telemetry:REDACTED
x-client-last-telemetry:REDACTED
x-ms-PKeyAuth:REDACTED
x-ms-lib-capability:REDACTED
client-request-id:REDACTED
return-client-request-id:REDACTED
x-app-name:REDACTED
x-app-ver:REDACTED
x-ms-client-request-id:04de6e7b-3d5d-4fd2-9611-ffa7e4ba10a2
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Identity/1.4.0,(.NET 5.0.9; Darwin 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64)
Content-Type:application/x-www-form-urlencoded
client assembly: Azure.Identity
DEBUG: Response [04de6e7b-3d5d-4fd2-9611-ffa7e4ba10a2] 200 OK (00.2s)
Cache-Control:no-store, no-cache
Pragma:no-cache
Strict-Transport-Security:REDACTED
X-Content-Type-Options:REDACTED
P3P:REDACTED
client-request-id:REDACTED
x-ms-request-id:14730548-b0d0-4e04-a6f4-2481b8388000
x-ms-ests-server:REDACTED
x-ms-clitelem:REDACTED
Set-Cookie:REDACTED
Date:Wed, 13 Oct 2021 15:20:21 GMT
Content-Type:application/json; charset=utf-8
Expires:-1
Content-Length:2155
DEBUG: ClientSecretCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2021-10-13T16:20:21.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '49793faf-eb3f-4d99-a0cf-aef7cce79dc1', UserId: '2a88cf98-ae31-4acf-9c09-56a365e86244'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/ae0b13d9-e09c-4e54-b1e6-8e777d8fbe14/resourceGroups/ba-n-zeaus-deareports-rg/providers/Microsoft.Consumption/budgets?api-version=2018-01-31
Headers:
x-ms-client-request-id : bc840721-c8ef-4afe-8ff3-c05416903c0b
Accept-Language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
Vary : Accept-Encoding
session-id : 0ea79935-231e-4321-a1ae-81a6bfce13ea
x-ms-request-id : 9ee82092-68ff-4214-9f2e-eaeaf7f832e4
x-ms-correlation-request-id : c21ac987-1fb8-4a3e-97ab-357792a860c2
x-ms-client-request-id : bc840721-c8ef-4afe-8ff3-c05416903c0b
X-Powered-By : ASP.NET
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-routing-request-id : SOUTHCENTRALUS:20211013T152023Z:c21ac987-1fb8-4a3e-97ab-357792a860c2
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Wed, 13 Oct 2021 15:20:22 GMT
Body:
{
"value": [
{
"id": "/subscriptions/ae0b13d9-e09c-4e54-b1e6-8e777d8fbe14/resourceGroups/ba-n-zeaus-deareports-rg/providers/Microsoft.Consumption/budgets/NewBudget",
"name": "NewBudget",
"type": "Microsoft.Consumption/budgets",
"eTag": "\"1d7bfb295dd6e96\"",
"properties": {
"timePeriod": {
"startDate": "2021-10-01T00:00:00Z",
"endDate": "2022-12-31T00:00:00Z"
},
"timeGrain": "Monthly",
"amount": 300.0,
"currentSpend": {
"amount": 0.000231454718435,
"unit": "USD"
},
"forecastSpend": {
"amount": 0.000231454718435,
"unit": "USD"
},
"category": "Cost",
"notifications": {
"actual_GreaterThan_95_Percent": {
"enabled": true,
"operator": "GreaterThan",
"threshold": 95.0,
"contactEmails": [],
"contactRoles": [],
"contactGroups": [
"/subscriptions/ae0b13d9-e09c-4e54-b1e6-8e777d8fbe14/resourceGroups/ba-n-zeaus-deareports-rg/providers/microsoft.insights/actionGroups/ba-n-zeaus-deareports-rg-actgrp"
],
"thresholdType": "Actual"
},
"forecasted_GreaterThan_105_Percent": {
"enabled": true,
"operator": "GreaterThan",
"threshold": 105.0,
"contactEmails": [],
"contactRoles": [],
"contactGroups": [
"/subscriptions/ae0b13d9-e09c-4e54-b1e6-8e777d8fbe14/resourceGroups/ba-n-zeaus-deareports-rg/providers/microsoft.insights/actionGroups/ba-n-zeaus-deareports-rg-actgrp"
],
"thresholdType": "Forecasted"
}
},
"filter": {}
}
},
{
"id": "/subscriptions/ae0b13d9-e09c-4e54-b1e6-8e777d8fbe14/resourceGroups/ba-n-zeaus-deareports-rg/providers/Microsoft.Consumption/budgets/DevonBudget",
"name": "DevonBudget",
"type": "Microsoft.Consumption/budgets",
"eTag": "\"1d7bfb9442db642\"",
"properties": {
"timePeriod": {
"startDate": "2021-10-01T00:00:00Z",
"endDate": "2022-12-31T00:00:00Z"
},
"timeGrain": "Monthly",
"amount": 1500.0,
"currentSpend": {
"amount": 0.0,
"unit": "USD"
},
"category": "Cost",
"notifications": {},
"filters": {
"resourceGroups": [],
"resources": [],
"meters": [],
"tags": {}
}
}
}
]
}
DEBUG: AzureQoSEvent: CommandName - Get-AzConsumptionBudget; IsSuccess - True; Duration - 00:00:01.4276215
DEBUG: Finish sending metric.
DEBUG: 10:20:24 AM - GetAzureRmConsumptionBudget end processing.
Any update on this issue?
Any updates on this?
Hi @DevonK3 , the power shell SDK for consumption is using an version of the budgets API, which works on an older format of filters i.e. the 'filters' property. On the other hand, Azure portal uses the latest API version where this property has been replaced with 'filter'. This new property supports many more dimensions for filtering. Since 'filter' is not backward compatible with 'filters', budgets created with non-empty 'filter' using the new API versions (or Azure portal) cannot be managed with the power shell SDK. Hence one of the budgets created via Azure Portal is not visible through Power shell.
There is currently no work planned to release an update for the power shell SDK. We instead recommend using the REST API (https://docs.microsoft.com/en-us/rest/api/consumption/budgets) or ARM templates (https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/quick-create-budget-template?tabs=CLI) to manage budgets.
Understood. I rewrote my scripts using Python SDK and it works fine. It doesn't make sense to use REST or ARM as I am trying to use PowerShell to get all Budgets for my Subscription.
Can you add this note in the Consumption SDK so others don't suffer the same issue?
@DevonK3, team is currently working on addressing this change in our documentation.
Will provide an update once this is done.
The documentation has been updated to reflect this aspect here : https://docs.microsoft.com/en-us/powershell/module/az.billing/get-azconsumptionbudget?view=azps-7.1.0#notes
Description
When I create a budget from PowerShell or Azure Portal, I can see them via the portal, PowerShell, or az. But, if I use Terraform
azurerm_consumption_budget_resource_group
, I see them in the Azure Portal and can even successfully edit them. But I cannot see them if I runGet-AzConsumptionBudget -ResourceGroupName $rg
or evenGet-AzConsumptionBudget
.Steps to reproduce
Environment data
Module versions
Debug output
Error output