---
sourceDocument: Yokohama Conversational Interfaces
sourceDocumentLink: https://www.servicenow.com/docs/r/yokohama/conversational-interfaces

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Conversational Interfaces

ft:clusterId :

    - convint

bundleId :

    - convint

workflow :

    - Platform


---

# Create a JavaScript function in Microsoft Azure using Visual Studio Code

# Create a JavaScript function in Microsoft Azure using Visual Studio
Code {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

To use Power Virtual Agents with Virtual Agent
Bot Interconnect, you must create a JavaScript function in Microsoft Azure using the sample code files in Bot Interconnect.

## Before you begin

You will need a Microsoft Azure account.

Role required: admin

## Procedure

1. Sign into Microsoft Azure and create a JavaScript function.  
   This involves configuring your environment and creating a local project. Refer to the [Microsoft documentation](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-node) for details.
2. Go to [Create an Azure Function for Microsoft Power Virtual Agents as Secondary bot with ServiceNow Bot Interconnect setup (KB1112368)](https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1112368), and then do the following:  
   You need to login to the Support portal to access the knowledge article.
   1. Copy the code in the index.txt file in the Attachments section into the index.js file in your Azure project.
   2. Copy the code in the function.txt file in the Attachments section into the function.json file in your Azure project.
   3. Save both files.
   {#create-js-function-azure-mspv-sec-bot__substeps_jpr_1yt_vsb}
3. Install the request-promise libraries.
   1. In a command line window, change directories to the folder where you created the Azure project.  
      For example, enter <kbd class="ph userinput">cd DemoAzureFunction</kbd>.
   2. At the prompt, enter: <kbd class="ph userinput">npm install --save request</kbd>
   3. At the prompt, enter: <kbd class="ph userinput">npm install --save request-promise</kbd>

   The dependencies are added to the package.json file in
   your project.

4. Deploy the project to Azure as described in the [Microsoft
   documentation](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-node).
5. From the Azure portal, navigate to All Resources.
6. Select the name of the function app that you've created.
7. On the Overview page, select the function you've created in the Functions tab, and copy the function URL from the Get function URL option.  
   The Azure function URL will be used as the secondary bot endpoint in your ServiceNow instance.  
**Previous topic:** [Using Microsoft Power Virtual Agents as a secondary bot with Virtual Agent Bot Interconnect](https://www.servicenow.com/docs/~DDvUZHDSr1EvW5C7wf9HA "With Bot Interconnect, you can use ServiceNow Virtual Agent as the primary bot with a Microsoft Power Virtual Agents secondary bot. All of the skills and topics available to Power Virtual Agents are made available to and executable from channels that are configured for ServiceNow Bot Interconnect.")  
**Next topic:** [Locate and copy the Direct Line secret key in Microsoft Power Virtual Agents](https://www.servicenow.com/docs/zP8bE2bMghQngLuQna_rfA "To use Power Virtual Agents with Virtual Agent Bot Interconnect, you must locate and copy the Direct Line security key in your Power Virtual Agents account.")

