Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.6k stars 821 forks source link

Create budget at management group level with service-principal login fails with 400 #5843

Closed andysworkshop closed 4 years ago

andysworkshop commented 5 years ago

Bug Report

Import:

"github.com/Azure/azure-sdk-for-go/services/consumption/mgmt/2019-01-01/consumption"

Attempting to create a budget at management group level and with a service principal login fails with code 400 message The Principal Id cannot be null/empty in the header.

Googling the error message returns nothing. Is there a magic header that has to be set when budgets are created at management group level with a connection authenticated by service-principal?

Request: (Authorization header not shown)

PUT //providers/Microsoft.Management/managementGroups/XXXXXXXX/providers/Microsoft.Consumption/budgets/MyBudget?api-version=2019-01-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.13 (amd64-windows) go-autorest/v13.0.0 Azure-SDK-For-Go/v32.5.0 consumption/2019-01-01 Terraform/0.12.6 terraform-provider-azurerm/dev
Content-Length: 726
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 88490d2e-edf1-818a-aa3b-4de697af3f2b
Accept-Encoding: gzip

{"properties":{"amount":"100.65","category":"Cost","filters":{"meters":["00000000-0000-0000-0000-000000000000"],"resources":["/subscriptions/{subscription-id}/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MYVM2","/subscriptions/{subscription-id}/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1"],"tags":{"category":["Dev","Prod"],"department":["engineering","sales"]}},"notifications":{"actual_greaterthan_80_percent":{"enabled":true,"operator":"GreaterThan","threshold":"80","contactEmails":["johndoe@contoso.com","janesmith@contoso.com"]}},"timeGrain":"Monthly","timePeriod":{"startDate":"2019-10-01T00:00:00Z","endDate":"2022-10-31T00:00:00Z"}}}

Response:

HTTP/2.0 400 Bad Request
Content-Length: 140
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 20 Sep 2019 15:36:56 GMT
Expires: -1
Pragma: no-cache
Session-Id: 587d2172-61bf-4407-98c3-5ce7aaa39821
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Client-Request-Id: 9e7e7bcb-91cf-4c25-829c-22c3749d528c
X-Ms-Correlation-Request-Id: 88490d2e-edf1-818a-aa3b-4de697af3f2b
X-Ms-Ratelimit-Remaining-Tenant-Writes: 1199
X-Ms-Request-Id: 077c6e01-a2aa-4dde-8eaa-4d1dd96e8eb2
X-Ms-Routing-Request-Id: UKSOUTH2:20190920T153656Z:2a6bade9-245d-4049-8b2e-1d79dff6c084
{"error":{"code":"400","message":"The Principal Id cannot be null/empty in the header. (Request ID: 077c6e01-a2aa-4dde-8eaa-4d1dd96e8eb2)"}}
ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ms-premp.

ms-premp commented 4 years ago

this is fixed.

ramaganesan-rg commented 4 years ago

Closing as per Prem's comments. If you still find the issue persisting, please feel free to reopen.