static async Task GetBearerTokenAsync()

in aspnet/Microsoft.Samples.XMLA.HTTP/Tester/Program.cs [274:293]


        static async Task<string> GetBearerTokenAsync(string clientId, string clientSecret, string tenantId)
        {
            var redirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob");

            //use this resourceId for Power BI Premium
            var resourceId = "https://analysis.windows.net/powerbi/api";

            //use this resourceId for Azure Analysis Services
            //var resourceId = "https://*.asazure.windows.net";
            
            var authority = $"https://login.microsoftonline.com/{tenantId}";
            // var clientId = "cf710c6e-dfcc-4fa8-a093-d47294e44c66";



            var ctx = new AuthenticationContext(authority);
            var token = await ctx.AcquireTokenAsync(resourceId, new ClientCredential(clientId,clientSecret));

            return token.AccessToken;
        }