Using Anypoint Studio to Configure Azure Service Bus Connector 3.4 | MuleSoft Documentation
# Using Anypoint Studio to Configure Azure Service Bus Connector 3.4
Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files.
To add and configure a connector in Studio:
  1. Create a Mule project.
  2. Add the connector to your Mule project.
  3. Configure an input source for the connector’s flow.
  4. Add a connector operation to the flow.
  5. Configure a global element for the connector.
     * Shared Access Signature (SAS)
     * Azure Active Directory (AAD)


If you are new to configuring connectors in Studio, see Using Anypoint Studio to Configure a Connector. If, after reading this topic, you need additional information about the connector fields, see the Azure Service Bus Connector Reference.
## Create a Mule Project
In Studio, create a new Mule project in which to add and configure the connector:
  1. In Studio, select **File > New > Mule Project**.
  2. Enter a name for your Mule project and click **Finish**.


## Add the Connector to Your Mule Project
Add Azure Service Bus Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file:
  1. In the **Mule Palette** view, click **(X) Search in Exchange**.
  2. In **Add Modules to Project** , type `azure service bus` in the search field.
  3. Click **Azure Service Bus** in **Available modules**.
  4. Click **Add**.
  5. Click **Finish**.


Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace.
## Configure an Input Source
An input source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Azure Service Bus Connector:
  * `Message Listener` Receives messages from the specified queue or subscription
  * `HTTP Listener` Initiates a flow each time it receives a request on the configured host and port
  * `Scheduler` Initiates a flow when a time-based condition is met


For example, to configure **Message listener** , follow these steps:
  1. In the **Mule Palette** view, select the Azure Service Bus Connector, then select **Message listener**.
  2. Drag **Message listener** to the Studio canvas.
  3. On the **Message listener** configuration screen, optionally change the value of the **Display Name** field.
  4. From **Acknowledgment mode** , select from these options:
     * **Auto** Automatic acknowledgment of the received message only if the application flow executes successfully
     * **Immediate** Automatic acknowledgment of the message once it is consumed and prior to any processing of the message
     * **Manual** Delegates the responsibility for acknowledging the message to the application logic
  5. In the **Destination** section, enter:
     * **Destination name** Name of the destination queue from which messages are received
     * **Subscription name** Name of the subscription from which messages are received
  6. Click the plus sign (+) next to the **Connector configuration** field to configure a global element that can be used by all instances of **Message listener** in the app.


## Add a Connector Operation to the Flow
When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform.
To add an operation for Azure Service Bus Connector, follow these steps:
  1. In the **Mule Palette** view, select **Azure Service Bus** and then select the desired operation.
  2. Drag the operation onto the Studio canvas to the right of the input source.


## Configure a Global Element for the Connector
When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials the connector uses to access the target Azure Service Bus Messaging system. One configuration you will have to configure is the connection provider. Azure Service Bus Connector accepts two types of connections:
  * Shared Access Signature (SAS)
  * Azure Active Directory (AAD)


### Shared Access Signature (SAS) authentication
To configure Shared Access Signature authentication for Azure Service Bus Connector, follow these steps:
  1. Select the name of the connector in the Studio canvas.
  2. In the configuration screen for the operation, click the plus sign (+) next to the **Connector configuration** field to access the global element configuration fields.
  3. On the **General** tab, select the `Shared Access Signature` in the connection dropdown, and configure the following required fields for SAS authentication:
    1. Enter the Azure **Service namespace**. This is the unique name assigned to the namespace when it was created and is the host-name portion of the URL, for example:
`https://{serviceNamespace}.servicebus.windows.net/{path}`
    2. Enter the Azure **Shared access key name**. This is the name of the SAS token configure in the Azure Service Bus namespace.
    3. Enter the Azure **Shared access key**. This is the name of your SAS token.
The following screenshot shows an example of configuring SAS authentication for Azure Service Bus Connector:
You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, see Anypoint Connector Configuration.
  4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy.
  5. Click **Test Connection** to confirm that Mule can connect with the specified server.
  6. Click **OK**.


Azure Service Bus Connector cannot perform a connectivity test at startup using the `Test Connection` button in the global element of the connector configuration when you restrict access to your resources and you have a security policy with permissions at the resource level only. This is because the security policy targets the root level of the namespace, which might be forbidden due to the customized policy applied to the shared access key.   
---  
### Azure Active Directory (AAD) authentication
To configure Azure Active Directory authentication for Azure Service Bus Connector, follow these steps:
  1. Select the name of the connector in the Studio canvas.
  2. In the configuration screen for the operation, click the plus sign (+) next to the **Connector configuration** field to access the global element configuration fields.
  3. On the **General** tab, select `Active Directory Connection` in the connection dropdown, and configure the following required fields for AAD authentication:
    1. Enter the Azure **Service namespace**. This is the unique name assigned to the namespace when it was created and is the host-name portion of the URL, for example:
`https://{serviceNamespace}.servicebus.windows.net/{path}`
    2. Enter the Azure **Tenant Id**.
    3. Enter the Azure **Client Id**.
    4. Enter the Azure **Client Secret**.
The following screenshot shows an example of configuring AAD authentication for Azure Service Bus Connector:
You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, see Anypoint Connector Configuration.
  4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy.
  5. Click **Test Connection** to confirm that Mule can connect with the specified server.
  6. Click **OK**.


Azure Service Bus Connector cannot perform a connectivity test at startup using the `Test Connection` button in the global element of the connector configuration when you restrict access to your resources and you have a security policy with permissions at the resource level only. This is because the security policy targets the root level of the namespace, which might be forbidden due to the customized policy applied to the app registration.   
---  
## View the App Log
You can view the app log as follows:
  * If you’re running the app from the Anypoint Platform, the output is visible in the Anypoint Studio console window.
  * If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path was customized in the app’s log file (`log4j2.xml`), you can also view the app log in this default location: `MULE_HOME/logs/<app-name>.log` For more information about the app log, see Configuring Logging.


### Reduce Excessive Logging
When using the **Message Listener** source, the Azure Service Bus library emits an INFO-level log message approximately every 30 seconds, indicating that no new messages were received. To avoid this excessive logging, add the following AsyncLogger element to the `log4j.xml` file:
`<AsyncLogger name="com.microsoft.azure.servicebus.primitives.CoreMessageReceiver" level="WARN"/>`
## Next Step
After you configure a global element and connection information, configure the other fields for the connector.
## See Also
  * Introduction to Anypoint Connectors
  * Using Anypoint Studio to Configure a Connector
  * Azure Service Bus Connector Reference
  * MuleSoft Help Center