Home > OS >  How to get Bearer token to connect to the Azure Logic App?
How to get Bearer token to connect to the Azure Logic App?

Time:10-11

From enter image description here

And the query result is successful. By copying the bearer token inside Postman I can get the result again inside it,

But,

How can I generate this bearer token inside C# Application via the HttpClient library or Postman?

How can I find the info to generate the token?

UPDATE

Let me update the post for more details I want to use this library VS Preferences

You'll need to make sure you add these three nuget packages ...

Azure.Identity
Azure.ResourceManager
Azure.ResourceManager.Logic

... and this is the example ...

using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Logic;
using System;
using System.Threading.Tasks;

namespace AzureManagement
{
    internal class Program
    {
        static void Main(string[] args)
        {
            GetLogicApps().Wait();
        }

        static async Task GetLogicApps()
        {
            var credential = new DefaultAzureCredential();
            var armClient = new ArmClient(credential);
            var subscription = await armClient.GetDefaultSubscriptionAsync();

            var logicAppsEnumerator = subscription.GetLogicWorkflowsAsync().GetAsyncEnumerator();

            try
            {
                while (await logicAppsEnumerator.MoveNextAsync())
                {
                    var logicApp = logicAppsEnumerator.Current;
                    Console.WriteLine(logicApp.Data.Name);
                }
            }
            finally
            {
                await logicAppsEnumerator.DisposeAsync();
            }

            Console.Read();
        }
    }
}

You haven't been specific about what you actually want to do but I suspect you'll be able to do what you want via this approach.

The code will also be secure whether you're coding in VS or deployed in Azure, as long as you use managed identities of course.

  • Related