Skip to content

Creating an Azure Application for SharePoint Online

A new Azure Active Directory application must be created and configured to support the Data Access Security SharePoint Online functionality.

This configuration can be performed either by running the automated PowerShell script supplied with the SailPoint distribution pack, or by creating and configuring the application through the Azure portal.

Creating and Configuring the Application Automatically

The script below will perform all the Azure application creation and configuration steps required for SharePoint Online.

To run this script, the Azure AD PowerShell module must be installed.

  1. Open PowerShell as an Administrator.
  2. Install the Azure AD PowerShell module: Install-Module -Name AzureAD
  3. Open the CreateSharePointOnlineAndOneDriveApp.ps1 file in a text editor to review the default parameters. The parameters can be edited in the file or passed as parameters when running the script.

    # Configures an Azure Application for use by Data Access Security SharePoint Online and One Drive Applications:
    #   Creates an Azure App with 'Sites.FullControl.All' and 'ActivityFeed.Read' API permissions.
    #   Creates and uploads a certificate as app client credential.
    #   Prompts for App admin consent.
    # NOTE: Must install Azure AD Powershell before running this script:
    #   Install-Module -Name AzureAD
       [string]$AppName = 'DAS SharePoint Online and OneDrive App',
       # DnsName will be included in Cert subject name
       [string]$CertDnsName = '',
       [int]$CertYearsValid = 10,
       [int]$SleepBeforeConsentSeconds = 30,
    # Stop the script on error
    $ErrorActionPreference = "Stop"
    'Connecting to Azure AD...'
    'Getting required API details...'
    # Get the Office 365 SharePoint Online API details.
    $spoApi = (Get-AzureADServicePrincipal -Filter "AppID eq '00000003-0000-0ff1-ce00-000000000000'")
    # Get the API permission ID
    $spoPermission = $spoApi.AppRoles | Where-Object { $_.Value -eq 'Sites.FullControl.All' }
    # Get the Office 365 Management API details.
    $o365Api = (Get-AzureADServicePrincipal -Filter "AppID eq 'c5393580-f805-4401-95e8-94b7a6ef2fc2'")
    # Get the API permission ID
    $o365Permission = $o365Api.AppRoles | Where-Object { $_.Value -eq 'ActivityFeed.Read' }
    'Building API permissions...'
    # Build the API permission object (TYPE: Role = Application, Scope = User)
    $apiPermission = @()
    $apiPermission += [Microsoft.Open.AzureAD.Model.RequiredResourceAccess]@{
       ResourceAppId  = $spoApi.AppId ;
       ResourceAccess = [Microsoft.Open.AzureAD.Model.ResourceAccess]@{
          Id   = $spoPermission.Id ;
          Type = "Role"
    $apiPermission += [Microsoft.Open.AzureAD.Model.RequiredResourceAccess]@{
       ResourceAppId  = $o365Api.AppId ;
       ResourceAccess = [Microsoft.Open.AzureAD.Model.ResourceAccess]@{
          Id   = $o365Permission.Id ;
          Type = "Role"
    'Registering Azure App...'
    # Register the new Azure App with API Permissions
    $myApp = New-AzureADApplication -DisplayName $AppName -ReplyUrls 'http://localhost' -RequiredResourceAccess $apiPermission
    # Display the new App properties
    "App Display Name: $($myApp.DisplayName)"
    "App ID: $($myApp.AppID)"
    'Creating certificate...'
    # Create certificate
    $myCert = New-SelfSignedCertificate -DnsName $CertDnsName -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears($CertYearsValid) -KeySpec KeyExchange
    'Exporting certificate files to disk...'
    # Export certificate to .pfx file
    $pfxFilePath = ".\$($AppName).pfx"
    $output = $myCert | Export-PfxCertificate -FilePath $pfxFilePath -Password $CertPassword
    # Display certificate pfx file path
    "Certificate pfx file path: $($output.FullName)"
    # Export certificate to .cer file
    $certFilePath = ".\$($AppName).cer"
    $output = $myCert | Export-Certificate -FilePath $certFilePath
    # Display certificate cer file path
    "Certificate cer file path: $($output.FullName)"
    $bin = $myCert.GetRawCertData()
    $base64Value = [System.Convert]::ToBase64String($bin)
    $bin = $myCert.GetCertHash()
    $base64Thumbprint = [System.Convert]::ToBase64String($bin)
    'Uploading certificate to Azure App...'
    # Upload and assign the certificate to Azure App
    $null = New-AzureADApplicationKeyCredential -ObjectId $myApp.ObjectID `
       -CustomKeyIdentifier $base64Thumbprint `
       -Type AsymmetricX509Cert -Usage Verify `
       -Value $base64Value `
       -StartDate ($myCert.NotBefore) `
       -EndDate ($myCert.NotAfter)
    "Waiting $SleepBeforeConsentSeconds seconds to allow the Azure App to be fully created before consent..."
    sleep $SleepBeforeConsentSeconds
    'Getting tenant details for consent...'
    # Get the tenant ID
    $tenantID = (Get-AzureADTenantDetail).ObjectID
    # Build the consent URL
    $consentURL = "$tenantID/adminconsent?client_id=$($myApp.AppId)"
    # Display the consent URL
    "Consent URL: $consentURL"
    'Launching browser for consent...'
    # Browse to the consent URL using the default browser
    Start-Process $consentURL
  4. Run the script:

    • To run the script with the default parameters from the directory where the script is located, run \CreateSharePointOnlineAndOneDriveApp.ps1
    • To run the script while overriding some of the default parameters, like DNS Name, years of certificate validity, or application name: .\CreateSharePointOnlineAndOneDriveApp.ps1 -AppName "OneDrive DAS App" -CertDnsName "" -CertYearsValid 15
  5. When prompted, log in with administrator credentials to create and configure Azure applications.

The last step of the script will launch a URL to grant admin consent for the application. When you grant consent, you will be redirected to a missing localhost URL. The operation is successful if the URL for that page contains admin_consent=True.


If you experience an access denied or other error in the web browser when granting admin consent, this might be a timing issue. This can be resolved by manually granting admin consent through the Azure portal. Alternatively you can copy and paste the consent URL into your browser. This is found in the script at: Consent URL:.

The following output should be gathered or noted when running the script. This information will be used to configure the SharePoint Online application in Data Access Security:

  1. The App ID value in the console output.
  2. The created certificate file <AppName>.pfx located in your working directory.
  3. The certificate password that was entered when prompted.

Creating and Configuring the Application Manually

The following steps will create and configure an Azure application for SharePoint Online authentication through the Azure portal.

These steps are adapted from the Microsoft SharePoint Online documentation.

Registering the Application in Azure AD

  1. Go to the the Azure AD portal.
  2. Under Manage Azure Active Directory, select View.
  3. On the Overview page that opens, under Manage, select App registrations.
  4. On the App registrations page that opens, select New registration.
  5. On the Register an application page that opens, configure the following settings:
  6. Name - Enter something descriptive, like "SharePoint Online DAS App"
  7. Supported account types - Verify that Accounts in this organizational directory only (<YourOrganizationName> only - Single tenant) is selected.
  8. Redirect URI (optional) - Leave empty.
  9. Select Register.

You will now assign API permissions to the application from this screen.

Assigning API Permissions to the Application

  1. On the app page under Manage, select Manifest.
  2. On the Manifest page, find the requiredResourceAccess entry.
  3. Replace the entire requiredResourceAccess entry with the following:

    "requiredResourceAccess": [
            "resourceAppId": "c5393580-f805-4401-95e8-94b7a6ef2fc2",
            "resourceAccess": [
                    "id": "594c1fb6-4f81-4475-ae41-0c394909246c",
                    "type": "Role"
            "resourceAppId": "00000003-0000-0ff1-ce00-000000000000",
            "resourceAccess": [
                    "id": "678536fe-1083-478a-9c59-b99265e6b0d3",
                    "type": "Role"
  4. Select Save.

  5. On the Manifest page, under Manage, select API permissions.
  6. On the API permissions page, verify that both Sites.FullControl.All and ActivityFeed.Read appear on the list.
  7. Select Grant admin consent for <Organization>. Read the confirmation dialog that opens.
  8. Select Yes in the confirmation dialog. The Status value should now be Granted for <Organization> on both entries.
  9. Close the API Permissions page (not the browser tab) to return to the App registrations page to generate a self-signed certificate.

Generating a Self-Signed Certificate

Create a self-signed x.509 certificate using the following PowerShell commands.

Edit parameters such as DnsName, Certificate expiration, and password as appropriate:

Create certificate

$mycert = New-SelfSignedCertificate -DnsName **""** -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(**15**) -KeySpec KeyExchange 

Export certificate to .pfx file

$mycert | Export-PfxCertificate -FilePath mycert.pfx -Password $(ConvertTo-SecureString -String "**P@ssw0Rd1234**" -AsPlainText -Force)

Export certificate to .cer file

$mycert | Export-Certificate -FilePath mycert.cer

Assigning the Certificate to the Azure Active Directory Application

After you register the certificate with your application, you can use the private key (.pfx file) for authentication.

  1. Go to the the Azure AD portal.
  2. Under Manage Azure Active Directory, select View.
  3. On the Overview page, under Manage, select App registrations.
  4. On the Apps registration page, select the application you registered.
  5. On the application page, under Manage, select Certificates & secrets.
  6. Select Upload Certificate.
  7. Browse to the self-signed certificate .cer file that you created when generating a self-signed certificate.
  8. Select Add.

The certificate is now shown in the Certificates section.

Documentation Feedback

Feedback is provided as an informational resource only and does not form part of SailPoint’s official product documentation. SailPoint does not warrant or make any guarantees about the feedback (including without limitation as to its accuracy, relevance, or reliability). All feedback is subject to the terms set forth at