Home

Installation, Configuration, and Usage of the AIP Scanner

The Azure Information Protection Scanner is a program designed to detect, classify, and optionally protecting documents stored on File Shares and On-Premises SharePoint servers. The overview below is from the official documentation at https://docs.microsoft.com/en-us/information-protection/deploy-use/deploy-aip-scanner.  This blog post is meant to assist customers and partners with deployment of the AIP Scanner.  If there is ever a conflict, the official documentation is authoritative.

 Azure Information Protection scanner architecture overview

The AIP Scanner runs as a service on Windows Server and lets you discover, classify, and protect files on the following data stores:

  • Local folders on the Windows Server computer that runs the scanner.
  • UNC paths for network shares that use the Common Internet File System (CIFS) protocol.
  • Sites and libraries for SharePoint Server 2016 and SharePoint Server 2013.

The scanner can inspect any files that Windows can index, by using iFilters that are installed on the computer. Then, to determine if the files need labeling, the scanner uses the Office 365 built-in data loss prevention (DLP) sensitivity information types and pattern detection, or Office 365 regex patterns. Because the scanner uses the Azure Information Protection client, it can classify and protect the same file types.

 

You can run the scanner in discovery mode only, where you use the reports to check what would happen if the files were labeled. Or, you can run the scanner to automatically apply the labels.

NOTE: The scanner does not discover and label in real time. It systematically crawls through files on data stores that you specify, and you can configure this cycle to run once, or repeatedly.

 

This blog post was written based on the 1.29.5 version of the AIP Scanner.  Every effort will be made to update it when things change, but if you run into difficulty running any of the commands on a newer version, please use the official documentation to identify any changes.

 

Prerequisites:

To install the AIP Scanner in a production environment, the following items are needed:

  • A Windows Server 2012 R2 or 2016 Server to run the service
    • Minimum 4 CPU and 4GB RAM physical or virtual 
      NOTE: TL;DR: More RAM is better.
      The scanner will allocate RAM 2.5-3 times of size of all files being scanned in parallel.  Thus, if you scan 40 files that are 20MB each at the same time, it should take about 20*2.5*40=2GB RAM. However, if you have one big 1GB file it can take 3GB of RAM just for that file.  
    • Internet connectivity necessary for Azure Information Protection
  • A SQL Server 2012+ local or remote instance (Any version from Express or better is supported)
    • Sysadmin role needed to install scanner service (user running Install-AIPScanner, not the service account)
      NOTE: If using SQL Server Express, the SQL Instance name is ServerName\SQLExpress
  • Service account created in On Premises AD and synchronized with Azure AD (I will call this account AIPScanner in this document)
    • Service requires Log on locally right and Log on as a service right (the second will be given during scanner service install)
    • Service account requires Read permissions to each repository for discovery and Read/Write permissions for classification/protection
  • AzInfoProtection.exe available on the Microsoft Download Center (The scanner bits are included with the AIP Client)
  • Labels configured for Automatic Classification/Protection

Installation:

 

NOTE: We have scripted the scanner installation process and it is now available at https://techcommunity.microsoft.com/t5/Azure-Information-Protection/Azure-Information-Protection-Sca.... Although these steps are still valid, the scripted method is far less prone to mistakes and much faster for deployment. 

 

A basic installation of the AIP Scanner service is simple and straightforward.

  1. Log onto the server where you will install the AIP Scanner service using an account that is a local administrator of the server and has permission to write to the SQL Server master database. (more restrictive scenarios are documented in the official documentation)
  2. Run AzInfoProtection.exe on the server and step through the client install (this also drops the AIP Scanner bits)
  3. Next, Right-click on the Windows button in the lower left-hand corner and click on Command Prompt (Admin) 
    Start Menu
  4. Type PowerShell and hit Enter
    PowerShell
  5. At the PowerShell prompt, type the following command and press Enter:
    Install-AIPScanner
  6. When prompted, provide the credentials for the scanner service account (YourDomain\AIPScanner) and password
  7. When prompted for SqlServerInstance, enter the name of your SQL Server and press Enter
    You should see a success message like the one below
    NOTE: If you get any errors at this point, verify network connectivity and resolve any permissions issues with the SQL Database before proceeding!
  8. Right-click on the Windows button in the lower left-hand corner and click on Run
  9. In the Run dialog, type services.msc and click OK
    Services
  10. In the Services console, double-click on the Azure Information Protection Scanner service
  11. On the Log On tab of the Azure Information Protection Scanner Service Properties, verify that Log on as: is set to the YourDomain\AIPScanner service account
    logon

Scanner Configuration:

After the install of the AIP Scanner binaries, you must authenticate with the AIP Scanner Service Account to get a token for use in automated discovery, classification, and protection.

Authentication Token:

  1. On the server where you installed the scanner, create a new text document on the desktop and name it something like Set-AIPAuthentication.txt
    • In this document, paste the line of PowerShell code below and save
      Set-AIPAuthentication -webAppId <ID of the "Web app / API" application> -webAppKey <key value generated in the "Web app / API" application> -nativeAppId <ID of the "Native" application>
  2. Open Internet Explorer and browse to https://portal.azure.com
  3. At the Sign in to Microsoft Azure page, enter the your tenant global admin credentials
  4. In the Microsoft Azure portal, click on Azure Active Directory in the left-hand pane
  5. Under Manage, click on App registrations
  6. In the App registrations blade, click the + New application registration button
  7. In the Create blade, use the values shown below to create the registration
  8. Click the Create button to complete the app registration
  9. In the AIPOnBehalfOf blade, hover the mouse over the Application ID and click on the Click to copy icon when it appears
  10. Minimize (DO NOT CLOSE) Internet Explorer and other windows to show the desktop
  11. On the desktop, return to Set-AIPAuthentication.txt and replace <ID of the "Web app / API" application> with the copied Application ID value
    and Save
    WARNING: Ensure there is only a single space after the Application ID before -webAppKey
  12. Return to the browser and click on the Settings button
  13. In the Settings blade, under API ACCESS, click on Keys
  14. In the Keys blade, add a new key by typing AIPClient in the Key description field and your choice of duration (1 year, 2 years, or never expires)
  15. Select Save and copy the Value that is displayed
    WARNING: Do not dismiss this screen until you have saved the value as you cannot retrieve it later
  16. Go back to the txt document and replace <key value generated in the "Web app / API" application> with the copied key value
    and Save

    WARNING: Ensure there is only a single space after the Application Key before -nativeAppId
  17. In the Microsoft Azure portal, click on Azure Active Directory in the left-hand pane
  18. Under Manage, click on App registrations
  19. In the App registrations blade, click the + New application registration button
  20. In the Create blade, use the values shown below to create the registration
  21. Click the Create button to complete the app registration
  22. In the AIPClient blade, hover the mouse over the Application ID and click on the Click to copy icon when it appears
  23. Replace <ID of the "Native" application > in the Set-AIPAuthentication.txt document with the copied Application ID value and Save

  24. Return to the browser and in the AIPClient blade, click on Settings
  25. In the Settings blade, under API ACCESS, select Required permissions
  26. On the Required permissions blade, click Add, and then click Select an APINOTE: It may take a few moments for each of these blades to load
  27. In the search box, type AIPO and click on AIPOnBehalfOf, and then click the Select button
  28. On the Enable Access blade, check the box next to AIPOnBehalfOf, click the Select button
  29. Click Done
  30. In the Required permissions blade, click Grant permissions
  31. In the popup window, click Yes
  32. Click on the Start menu and type PowerShellright-click on the PowerShell program, and click Run as a different user.
  33. In the Run as different user dialog, insert the AIP Scanner Service credentials
  34. In the Scanner Service context PowerShell window, paste the completed command from Set-AIPAuthentication.txt and press Enter
  35. When prompted, enter the user AIPScanner@yourdomain.com and the password
    NOTE: Replace yourdomain with the your tenant
  36. You will see the message below in the PowerShell window once complete

About Policies:

Now that the scanner has an authentication token, we should discuss what you want to do with the AIP Scanner.  We know that you want to use it to scan file shares and SharePoint sites, but some discussion needs to be had about how the scanner locates data and what the scanner will do once it finds it. 

 

AIP Policies contain Labels and Sub-labels that allow you to classify and optionally protect data.  You can assign conditions to these labels using standard Office 365 DLP templates and have those conditions be recommended or automatic.  For the AIP Scanner to classify documents, you must set these conditions to be Automatic.  This allows the AIP Scanner to protect content without the need for user input.  This is a content based approach and labels are assigned to content based on the conditions defined in each label.  If you want all of the documents in your repositories to be classified, then you can use the default label setting in the portal and the AIP Scanner will assign that label to any content that does not meet any other automatic criteria. This is done in the Global policy blade, under the Configure settings to display and apply on Information Protection end users section.

NOTE: Use caution when using a default label as this will label any file that is not caught by properly defined conditions.  This could potentially result in improper classification of many documents if not tested appropriately.

 

For more in-depth information about configuring policies, you can see the official documentation at https://docs.microsoft.com/en-us/information-protection/deploy-use/configure-policy-classification

Configuring Repositories:

Repositories can be on-premises SharePoint 2013 or 2016 document libraries or lists and any accessible CIFS based share.  
NOTE: In order to do discovery, classification, and protection, the scanner service pulls the documents to the server, so having the scanner server located in the same LAN as your repositories is recommended. You can deploy as many servers as you like in your domain, so putting one at each major site is probably a good idea (Microsoft currently uses around 40 Scanner instances worldwide for internal repositories and will be expanding that to 240).

  1. To add a file share repository, open a PowerShell window and run the command below
    Add-AIPScannerRepository -Path \\fileserver\documents
  2. To add a SharePoint 2013/2016 document library run the command below
    Add-AIPScannerRepository -Path http://sharepoint/documents
  3. To verify that the repositories that are configured, run the command below
    Get-AIPScannerRepository

Sensitive Data Discovery:

One of the most useful features of the AIP Scanner is the discovery of sensitive data across all of your configured repositories.  You can do this by using Set-AIPScannerConfiguration with a switch called -DiscoverInformationTypes.  When this switch is set to All, the scanner will discover files that contain any data in the list of all Office 365 DLP sensitive data types, and any custom string or regex values that you have specified as automatic conditions for labels in the Azure Information Protection policy. When you use this option, labels do not need to be configured to use any conditions for the Office 365 sensitive data types, but you will need automatic conditions configured for custom string or regex values.
NOTE: The labels for the custom values can be applied to a policy scoped just to the AIP Scanner service account if you do not want them triggering on your global labels.

 

The PowerShell command below will allow you to scan your repositories against all information types.

 

Set-AIPScannerConfiguration -Enforce Off -Schedule OneTime -Type Full -DiscoverInformationTypes All
 

To start the discovery, use the PowerShell command below


Start-Service AIPScanner

 

After running the scan, you can review the logs by opening the Azure Information Protection event log or you can view the detailed logs at C:\users\<Scanner Service Account Profile>\appdata\local\Microsoft\MSIP\Scanner\Reports.  There you will find the summary txt and detailed csv files.

 

Running this command on your defined repositories will show you all of the sensitive data types you currently have in those repositories.  You can then use this information to define conditions on labels so you can properly classify and protect your content.  

 

Enforcement:

Once you have your conditions defined, type the PowerShell command below to enforce protection and have the scanner run once.

 

Set-AIPScannerConfiguration -Enforce On -Schedule OneTime -Type Full

NOTE: After testing, you would use the same command with the -Schedule Continuous command to have the AIP Scanner run continuously.
NOTE: The -Type Full switch forces the scanner to review every document. 

 

To start the initial enforcement scan, use the PowerShell command below

 

Start-Service AIPScanner

 

You should now be able to review the event log and AIP Scanner log files to see what files have been classified and protected. 

 

The last item you will want to do is set the scanner to continuously monitor the repositories you have defined for new content.  This can be done using the PowerShell commands below.

 

Set-AIPScannerConfiguration -Enforce On -Schedule Continuous

Start-Service AIPScanner

 

You should now have a fully functional AIP Scanner instance.  You can repeat this process on multiple servers as necessary and use the same Set-AIPAuthentication command for each of them.  This is a simple setup for a basic scanner server that can be used to protect a large amount of data easily.  I highly recommend reading the official documentation on deploying the scanner as there are some less common caveats that I have left out and they cover performance tips and other additional information.

 

Thanks,

The Information Protection Customer Experience Team

 

 
14 Comments
Frequent Visitor

Hi kevin!

First, Thanks for your quickly reply! but I have more just one question.

 

Upload my SQL Server information photo.제목 없음.png

You see my SQL Server information and tell me how to install AIP Scanner!

Based on the SQL settings in the picture it appears that you should be able to simply use the local server name when asked for the SQL Server. 

 

Hope this helps,

Kevin

Frequent Visitor

Hi, @Kevin McKinnerney 

 

I think my problem is wrong use 'Service Account' in Prerequisites.

Can you explain how create Service Account for me?

 

Thank you.

The Service Account is an account you create on premises and sync into Azure AD.  It requires the rights as explained in this article but these are standard and should not be a problem in most environments.

 

  • Service requires Log on locally right and Log on as a service right (the second will be given during scanner service install)
  • Service account requires Read permissions to each repository for discovery and Read/Write permissions for classification/protection

Additional information about the Service Account and advanced permissions can be found at https://docs.microsoft.com/en-us/azure/information-protection/deploy-aip-scanner#prerequisites-for-t... and https://docs.microsoft.com/en-us/azure/information-protection/deploy-aip-scanner#deploying-the-scann...

Frequent Visitor

I'm sorry to ask you again and again.

 

I'm created local user in AD server and added SQL server logins user(is mean Log on as a service. right?).

How grant Read/Write permission to Service Account.1.png

 

Thank you.

Occasional Visitor

PS C:\Windows\system32> Install-AIPScanner
Install-AIPScanner : The term 'Install-AIPScanner' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Install-AIPScanner
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-AIPScanner:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS C:\Windows\system32>

Occasional Visitor

 The transacted install has completed.
Install-AIPScanner : A network-related or instance-specific error occurred while establishing a connection to SQL
Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server
is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)
At line:1 char:1
+ Install-AIPScanner
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Install-AIPScanner], PowershellException
+ FullyQualifiedErrorId : Microsoft.InformationProtection.Powershell.AIP.Commandlets.Scanner.InstallAIPScannerComm
and

Frequent Visitor

I had difficulty creating a service account, but I set up a service account in a security policy called 'secpol.msc', and then I set up a login to the corresponding AIP-Scanner service account with local group policy editing.

Now it works. Thank you for helping us set up so far.

AmanDeep,

 

I am glad to see you got past your initial issue which appeared to be that the AIP Client was not installed before you attempted to run the Powershell Install-AIPScanner cmdlet. 

 

The current error you are having appears to be due to a network or permissions issue with the SQL server.  Please ensure that the account you are logged in as when running the install command has sysadmin rights to the SQL database and good network connectivity.  You may want to install SQL express locally as the install account as that would solve both issues.

Occasional Visitor

Thanks for your reply.

 

I am using same Server for AIP Scanneer & SQL Express 2017 installed on it.

 

Not sure why i got N/W related Error.

 

I am using default SQL Instance given most permissions to Master DB please let me know if anything is missing.

 

Service has come up but not running is it common behavior.

 

I will wait for your response before i proceed further.

Occasional Visitor

Able to Fix above issue

now facing issue in 

When prompted, enter the user AIPScanner@yourdomain.com and the password
NOTE: Replace yourdomain with the your tenant

 

et-AIPAuthentication : Error acquiring token
t line:1 char:1
Set-AIPAuthentication -webAppId 93cc647b-4f0c-49ca-85d2-b7fa8eb20176 ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : AuthenticationError: (:) [Set-AIPAuthentication], PowershellException
+ FullyQualifiedErrorId : Microsoft.InformationProtection.Powershell.AIP.Commandlets.SetAIPAuthenticationCmdLet

Occasional Visitor
"Able to Fix above issue
now facing issue in 
When prompted, enter the user AIPScanner@yourdomain.com and the password
NOTE: Replace yourdomain with the your tenant
Set-AIPAuthentication : Error acquiring token"

@AmanDeep Singh This is most likely because on step 20 you didn't set application type to Native.  Create a new App and try again.



 

Senior Member

Edit 2 : problem solved seems I just needed to be patient :)

Hi all,

AIP Scanner was working fine before Ignite. Upgraded the AIP client and now am also getting the error :Set-AIPAuthentication : Error acquiring token

To be sure I recreated my API as described above. Tempted to try the preview of the AIP scanner to see if the issue persists.

Any idea is appreciated :)

Thanks

Edit : Upgraded to latest preview client same issue.

Hi Thomas,

 

I am glad you got it working.  You shouldn't have to wait for anything when installing.  I have scripted this install on the newer blog at https://techcommunity.microsoft.com/t5/Azure-Information-Protection/Azure-Information-Protection-Sca.... If you are looking to use the preview dashboards, you can deploy using the scripts at https://techcommunity.microsoft.com/t5/Azure-Information-Protection/Cataloging-your-Sensitive-Data-w....

 

Thanks!

Kevin