Deploy a connector to archive Facebook Business pages data

This article contains the step-by-step process to deploy a connector that uses the Office 365 Import service to import data from Facebook Business pages to Microsoft 365. For a high-level overview of this process and a list of prerequisites required to deploy a Facebook connector, see Set up a connector to archive Facebook data.

Tip

If you're not an E5 customer, use the 90-day Microsoft Purview solutions trial to explore how additional Purview capabilities can help your organization manage data security and compliance needs. Start now at the Microsoft Purview compliance portal trials hub. Learn details about signing up and trial terms.

Step 1: Create an app in Microsoft Entra ID

  1. Go to https://portal.azure.com and sign in using the credentials of a global admin account.

    Create app in AAD.

  2. In the left navigation pane, select Microsoft Entra ID.

    Select Microsoft Entra ID.

  3. In the left navigation pane, select App registrations (Preview) and then select New registration.

    Select App registrations (Preview) and then select New registration.

  4. Register the application. Under Redirect URI, select Web in the application type dropdown list and then type https://portal.azure.com in the box for the URI.

    Register the application.

  5. Copy the Application (client) ID and Directory (tenant) ID and save them to a text file or other safe location. You use these IDs in later steps.

    Copy the Application ID and Directory ID and save them.

  6. Go to Certificates & secrets for the new app.

    Go to Certificates & secrets for the new app.

  7. Select New client secret

    Select New client secret.

  8. Create a new secret. In the description box, type the secret and then choose an expiration period.

    Type the secret and then choose an expiration period.

  9. Copy the value of the secret and save it to a text file or other storage location. This is the Microsoft Entra application secret that you use in later steps.

    Copy the value of the secret and save it.

Step 2: Deploy the connector web service from GitHub to your Azure account

  1. Go to this GitHub site and select Deploy to Azure.

    Select Deploy to Azure.

  2. After you select Deploy to Azure, you will be redirected to an Azure portal with a custom template page. Fill in the Basics and Settings details and then select Purchase.

    • Subscription: Select your Azure subscription that you want to deploy the Facebook Business pages connector web service to.

    • Resource group: Choose or create a new resource group. A resource group is a container that holds related resources for an Azure solution.

    • Location: Choose a location.

    • Web App Name: Provide a unique name for the connector web app. Th name must be between 3 and 18 characters in length. This name is used to create the Azure app service URL; for example, if you provide the Web app name of fbconnector then the Azure app service URL will be fbconnector.azurewebsites.net.

    • tenantId: The tenant ID of your Microsoft 365 organization that you copied after creating the Facebook connector app in Microsoft Entra ID in Step 1.

    • APISecretKey: You can type any value as the secret. This is used to access the connector web app in Step 5.

      Select Create a resource and type storage account.

  3. After the deployment is successful, the page will look similar to the following screenshot:

    Select Storage and then select Storage account.

Step 3: Register the Facebook app

  1. Go to https://developers.facebook.com, log in using the credentials for the account for your organization's Facebook Business pages, and then select Add New App.

    Add a new app for Facebook business page.

  2. Create a new app ID.

    Create a new app ID.

  3. In the left navigation pane, select Add Products and then select Set Up in the Facebook Login tile.

    Select Add Products.

  4. On the Integrate Facebook Login page, select Web.

    Select Web on the Integrate Facebook Login page.

  5. Add the Azure app service URL; for example https://fbconnector.azurewebsites.net.

    Add the Azure app service URL.

  6. Complete the QuickStart section of the Facebook Login setup.

    Complete the QuickStart section.

  7. In the left navigation pane under Facebook Login, select Settings, and add the OAuth redirect URI in the Valid OAuth Redirect URIs box. Use the format <connectorserviceuri>/Views/FacebookOAuth, where the value for connectorserviceuri is the Azure app service URL for your organization; for example, https://fbconnector.azurewebsites.net.

    Add the OAuth redirect URI to the Valid OAuth Redirect URIs box.

  8. In the left navigation pane, select Add Products and then select Webhooks. In the Page pull-down menu, select Page.

    Select Add Products and then select **Webhooks.

  9. Add Webhooks Callback URL and add a verify token. The format of the callback URL, use the format <connectorserviceuri>/api/FbPageWebhook, where the value for connectorserviceuri is the Azure app service URL for your organization; for example https://fbconnector.azurewebsites.net.

    The verify token should similar to a strong password. Copy the verify token to a text file or other storage location.

    Add the verify token.

  10. Test and subscribe to the endpoint for feed.

    Test and subscribe to the endpoint.

  11. Add a privacy URL, app icon, and business use. Also, copy the app ID and app secret to a text file or other storage location.

    Add a privacy URL, app icon, and business use.

  12. Make the app public.

    Make the app public.

  13. Add user to the admin or tester role.

    Add user to the admin or tester role.

  14. Add the Page Public Content Access permission.

    dd the Page Public Content Access permission.

  15. Add Manage Pages permission.

    Add Manage Pages permission.

  16. Get the application reviewed by Facebook.

    Get the application reviewed by Facebook.

Step 4: Configure the connector web app

  1. Go to https://<AzureAppResourceName>.azurewebsites.net (where AzureAppResourceName is the name of your Azure app resource that you named in Step 4). For example, if the name is fbconnector, go to https://fbconnector.azurewebsites.net. The home page of the app will look like the following screenshot:

    Go to you connector web app.

  2. Select Configure to display a sign in page.

    Select Configure to display a sign in page.

  3. In the Tenant Id box, type or paste your tenant Id (that you obtained in Step 2). In the password box, type or paste the APISecretKey (that you obtained in Step 2), and then select Set Configuration Settings to display the configuration details page.

    Sign in using your tenant Id and password and go to configuration details page.

  4. Enter the following configuration settings

    • Facebook application ID: The app ID for the Facebook application that you obtained in Step 3.

    • Facebook application secret: The app secret for the Facebook application that you obtained in Step 3.

    • Facebook webhooks verify token: The verify token that you created in Step 3.

    • Microsoft Entra application ID: The application ID for the Microsoft Entra app that you created in Step 1.

    • Microsoft Entra application secret: The value for the APISecretKey secret that you created in Step 1.

  5. Select Save to save the connector settings.

Step 5: Set up a Facebook connector

Select the appropriate tab for the portal you're using. To learn more about the Microsoft Purview portal, see Microsoft Purview portal. To learn more about the Compliance portal, see Microsoft Purview compliance portal.

  1. Sign into the Microsoft Purview portal.

  2. Select Settings > Data connectors.

  3. Select My connectors, then select Add connector.

  4. From the list, choose Facebook Business pages.

  5. On the Terms of service page, select Accept.

  6. On the Add credentials for your connector app page, enter the following information and then select Validate connection.

    • In the Name box, type a name for the connector, such as Facebook news page.
    • In the Connection URL box, type or paste the Azure app service URL; for example https://fbconnector.azurewebsites.net.
    • In the Password box, type or paste the value of the APISecretKey that you added in Step 2.
    • In the Azure App ID box, type or paste the value of the Application (client) ID also called as Microsoft Entra Application ID that you created in Step 1.
  7. After the connection is successfully validated, select Next.

  8. On the Authorize Microsoft 365 to import data page, type or paste the APISecretKey again and then select Login web app.

  9. On the Configure Facebook connector app page, select Login with Facebook and log in using the credentials for the account for your organization's Facebook Business pages. Make sure the Facebook account that you logged in to is assigned the admin role for your organization's Facebook Business pages.

  10. A list of the business pages managed by the Facebook account that you logged in to is displayed. Select the page to archive and then select Next.

  11. Select Continue to exit the setup of the connector service app.

  12. On the Set filters page, you can apply a filter to initially import items that are a certain age. Select an age, and then select Next.

  13. On the Choose storage location page, type the email address of Microsoft 365 mailbox that the Facebook items will be imported to, and then select Next.

  14. Select Next to review the connector settings and then select Finish to complete the connector setup.