none
Authentication information is not given in the correct format. Check the value of Authorization header in Azure Ratecard Apis RRS feed

  • Question

  • Hi All,

    I am trying to get azure rate card details by following api in asp.net core application,

    API:

    https : //management.azure.com/subscriptions/{Sub Id}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0044P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'

    It was working earlier, but recently getting the below response,

    Exception:

    "System.Net.WebException: 'The remote server returned an error: (400) Authentication information is not given in the correct format. Check the value of Authorization header..'"

    Please find my code below here, The same code was working properly in .net framework console.

    Code:

    string requestUrl = "https : //management.azure.com/subscriptions/{Sub Id}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0044P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"

    string accessToken = "Auth token here";

    var usageRequest = (HttpWebRequest)WebRequest.Create(requestUrl);

    usageRequest.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + accessToken);

    usageRequest.ContentType = "application/json";

    var response = (HttpWebResponse)usageRequest.GetResponse();                                            

    var receiveStreams = response.GetResponseStream();

    var readStreams = new StreamReader(receiveStreams, Encoding.UTF8);

    var readData = readStreams.ReadToEnd();

    Any ideas if anything changed on the Microsoft side or any another way to solve this exception ?

    Regards,

    Anand K
    • Moved by Fei Hu Tuesday, May 8, 2018 3:03 AM Moved From C#
    Saturday, May 5, 2018 5:12 AM

All replies

  • Hello Anand,

    Your question is more related to Azure Ratecard Apis, you need to repost a new thread to Azure Community Support for better support.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 7, 2018 2:08 AM