Grant Access to Selected Sites

If you want to grant users access to specific SharePoint sites through the Azure portal, follow the steps below:

  1. Create connector for respective SharePoint site in Attach2Dynamics. Follow this link to know how to create connector.

Note: For enabling this feature user must set “Allow Permission for Selected Site” field to “Yes”. This field is hidden on the form and user must make this field visible for enabling it.

  1. Create azure app

Please follow the below steps to create Azure Active Directory (AAD) app:

Step 1 – Login into Azure portal –

Step 2 – Click on Azure Active Directory.

Step 3 – Navigate to App registrations and then click on new registration.

  • Now click on “Register” button.

Step 4 – Now you need to give some permissions to app. So, navigate to API permissions. Here you need to go to “Add Permission” for Dynamics 365 CRM and SharePoint.

• To add permissions, click on Dynamics CRM.

  • Grant User Impersonation access.

  • To add SharePoint permissions, navigate to Microsoft Graph.

  • Select “Application Permissions.”

  • To grant users access to selected sites, select “Sites.Selected” permission.

  • Navigate to SharePoint.

  • Select "Application Permission."

• To grant users access to selected sites, select “Sites.Selected" permission.

  • Click on “Grant admin consent” button as shown below.

  • Navigate to “Authentication”, enable Access Tokens, and click on ‘Save’.

  • Now, navigate to Certificate & Secrets and click on New client secret to create a secret key.

Note: Please copy the secret key immediately and keep it for future reference as it will disappear after some time.

  • Copy the “Application ID” and “Secret Key”.

  • Go to Dynamics 365 CRM and navigate to Attach2Dynamics app -> Connector Entity -> Credentials Tab and paste both “Application ID” and “Secret Key”.

  • To authenticate the connector, you’ll first need to run a PowerShell script.

  • Download the PowerShell script from here.

Note: User need to install PowerShell version 7.0 and above.

  • Once you have installed PowerShell on your device. Open the PowerShell command window and select “Run as Administrator”.

• Now enter the syntax as &”file path\PowerShell script name” and click ‘Enter’ to Run the command.

Note: Enter the file path where you have stored the PowerShell script in your device and the name of the PowerShell script in the above syntax.

  • Now, in the PowerShell command window, enter the following details:

    • SharePoint site URL

    • Azure App ID

    • Tenant Name

    • Secret key of Azure App

    • Display name of Azure App

  • A Pop-up window will appear. Fill in your credentials and then a confirmation Pop-up will be opened. In the Pop-up, please select Consent on behalf of your organization --> Click on the Accept button.

  • Once the script has been executed successfully, you will be able to see “Completed” message on the command window, as shown in the below image.

• Once the script has been successfully executed navigate to Attach2Dynamics App -> Connectors entity, and click on the Authenticate Button.

  • After clicking on the Accept button if the credentials are correct then you will get a Success message window.

For any queries, reach out to us at

Last updated