logic app access management rest from service bus

# Logic App Access Management Rest from Service Bus

Are you interested in accessing your Logic Apps but unsure of how to manage this from the Service Bus? In this article, we’ll explore the steps you need to take to set this up via REST API.

## Prerequisites

Before we dive into the steps needed to access your Logic Apps from the Service Bus, there are a few prerequisites you’ll need to ensure are in place first:

– Azure subscription
– Azure Service Bus namespace
– Logic App workflow

Once you have these set up, you can move onto the next steps.

## Configure Service Bus

To enable access to your Logic App workflow from Service Bus, you’ll need to configure a few settings.

1. From your Azure portal, navigate to your Service Bus namespace.
2. Under ‘Shared Access Policies’, select ‘RootManageSharedAccessKey’.
3. Under ‘Key name’ and ‘Primary key’, copy and save the values.

With this information saved, you’re now ready to move onto the next steps.

## Register the App

To allow the REST API to access your Logic App, you’ll need to register the app.

1. From your Azure portal, navigate to the ‘Azure Active Directory’ section.
2. Under ‘App registrations’, select ‘New registration’.
3. Enter a name for your app and choose ‘Web’ as the ‘Application type’.
4. Enter a redirect URI for your app and click ‘Register’.

Your app should now show up under ‘App registrations’.

## Get Access Token

With your Service Bus configured and your app registered, it’s time to obtain an access token.

1. Using your preferred HTTP client, send a POST request to the following endpoint: ‘https://login.microsoftonline.com/{tenant-id}/oauth2/token’.
2. In the request body, include the following values:

– grant_type: client_credentials
– client_id: {client-id}
– client_secret: {client-secret}
– resource: ‘https://management.azure.com/’

3. Send the request to obtain the access token.

## Use Access Token

With your access token, you can now use it to access your Logic App workflow from the Service Bus.

1. Using your preferred HTTP client, send a POST request to the following endpoint: ‘https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Logic/workflows/{workflow-name}/triggers/{trigger-name}/run?api-version=2016-06-01’.

2. In the request header, include the following values:

– Authorization: Bearer {access-token}
– Content-Type: ‘application/json;charset=utf-8’
– x-ms-client-request-id: {client-request-id}

3. In the request body, include any parameters needed for your Logic App workflow.

4. Send the request to trigger the workflow.

And that’s it! Follow these steps and you’ll be able to access your Logic App workflow from the Service Bus via REST API.

Leave a Comment