Bing Content api Access token using Microsoft Identity Platform RRS feed

  • Question

  • I need to send product feed to our merchant account catalog.

    I am following guide from to send Product Feed.
    I have server side application that runs in background without any human involvement.

    I have followed the instruction from below link and registered new app on Azure AD

    In App permissions I searched for Bings Ads or Content Api to add permissions but could not find the required Permission.

    I have followed the code sample for deamon app to get access. I have got the Access token with scopes( and api://tenant-id/.default) but when I used this Access Token to post Product Feed using the endpoint{merchant-Id}/products/batch?bmc-catalog-id={CatalogId}&alt=json I get response "401 Unathorised"

    I have following questions

    • Is it possible to get Access Token without prompting user consent as my application is only server side and no human involvement?
    • Could you please help me understand this Access Token Access for Bing Ad Api using Microsoft Identity Platform?
    • How I can add scope for Content Ads Api in Azure App?

    Any sample code for .NET or integration documentation will be helpful to understand how Microsoft Identity Platform works with Content api.

    Thank You

    Wednesday, April 22, 2020 12:59 PM

All replies

  • If you registered an app exactly as described here, then you should only need to use the and offline_access scopes when requesting the access token (and you don't need to add them in the  portal). I suggest please try the PowerShell Quick Start here, since a Client Id is already provided. Then try replacing it with your Client Id.

    We will also look into updating this sample (or you can modify it), otherwise the concept is the same as Bing Ads API documentation with respect to the Microsoft Identity endpoint. 


    Also note, per FAQ:

    To programmatically manage a Microsoft Advertising account, you must provide consent at least once through the web application consent flow. For repeat or long term authentication, you should follow the authorization code grant flow for obtaining an access token and refresh token. Thereafter you can use the latest refresh token to request new access and refresh tokens without any further user interaction.

    Please let me know if you have any follow up questions.



    Wednesday, April 22, 2020 8:35 PM
  • Thank You Eric for update

    Instead of using authorization code grant flow Can I use Microsoft Identity Client nuget package for Authentication of Content Api and get valid access token?

    I have tried to add and offline_access scopes but I get Invalid Scope exception. My code is below.

     var authority = "{tenant}"; 
    var scopeUrl = "";
    string[] scopes = new string[] { scopeUrl };
    IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(clientId)
                        .WithAuthority(new Uri(authority))
        var result = await app.AcquireTokenForClient(scopes)
        if (result != null)
    catch (Exception exc)
        _logger.LogError("Bing feed Auth exception", exc);

    Thursday, April 23, 2020 10:15 AM
  • Last I checked there were some challenges / obstacles to using Microsoft Identity Client nuget package for Bing Ads API and Content API. I recommend installing Microsoft.BingAds.SDK, which has custom classes to handle the required scopes automatically. Some internal details are here, and example usage is here

    Please let me know if you have any follow up questions. 



    Thursday, April 23, 2020 2:51 PM