vScope uses SQL querys to inventory Microsoft SQL. For a complete MS SQL documentation, vScope need the following permissions:
- Various SERVERPROPERTY-settings, to read general properties, like Edition and MachineName etc
- vScope also needs read access to tables in the following databases:
- master
- msdb
- model
- sys
- Various stored procedures are also run:
- sp_who
- sp_who2
- sp_readerrorlog
- xp_enumerrorlogs
- sp_spaceused
vScope will work even if access is denied to some of the above objects, but the information will not be complete. vScope cannot write anything to any database or read content from any user databases.
vScope use default instance port TCP 1433 and SQL Server Browser service UDP 1434. Other instances use random assigned ports. Make sure than no Firewall is blocking vScope from accessing the databases on those ports.
Guide to assign minimum permissions to a new user using SSMS
- Connect to your database instance with Microsoft SQL Server Management Studio (SSMS)
- Add a new user vscopesqluser by right clicking Security->Logins and selecting ‘New Login…’
- Enter Login name: vscopesqluser
- Select SQL Server Authentication
- Enter password:
- Select Server Roles page. Make sure the ‘public’ role is selected.
- Select User Mapping page. Make sure the following is true:
- Tick the ‘Map’ checkbox for all databases
- For all databases: The ‘public’ role should be ticked
- For system databases master, msdb and tempdb: Also tick ‘db_datareader
- For system database msdb: Also tick ‘SQLAgentReaderRole’
- Click OK to create the user
- Right click the root in the Object Explorer (the instance). Select ‘Properties’
- Select the Permissions page.
- Click ‘vscopesqluser’ in the Logins or roles list.
- Make sure the following four permissions have the Grant checkbox ticked:
- Alter trace
- Connect SQL
- View any definition
- View server state
- Click OK to save permissions
- Right click Databases -> System Databases -> master -> Security -> Users -> vscopesqluser and select Properties
- Select the Securables page.
- Click ‘Search…’
- Select ‘Specific Objects…’ and click OK
- Click ‘Objects Types…’ and tick ‘Extended stored procedures’ and click OK
- In the ‘Enter the object names to select’, enter ‘error’ and click ‘Check Names’
- In the search results that appear, tick ‘xp_readerrorlog’ and ‘xp_enumerrorlogs’ and click OK
- Click OK again. The selected securables should now be listed under ‘Securables’
- For both the securables, make sure Grant is ticked for the Execute permission.
- Click OK
- Right click Databases -> System Databases -> msdb -> Security -> Users -> vscopesqluser and select Properties
- Select the Securables page.
- Click ‘Search…’
- Select ‘Specific Objects…’ and click OK
- Click ‘Objects Types…’ and tick ‘Stored procedures’ and click OK
- In the ‘Enter the object names to select’, enter ‘help_job’ and click ‘Check Names’
- In the search results that appear, tick ‘sp_help_job’ and click OK
- Click OK again. The selected securable should now be listed under ‘Securables’
- For sp_help_job securable, make sure Grant is ticked for the Execute permission.
- Click OK
- Done! You should now be able to scan your SQL database with vScope. Remember, every time you add a new database to your instance, make sure that you map your vscopesqluser to that database with minimum ‘public’ role. If you fail to do this, vScope will not be able to read information about that database.