Showing posts with label SQL 2014. Show all posts
Showing posts with label SQL 2014. Show all posts

11/29/16

What SQL Server is my SharePoint machine pointed to?

I recently powered on a SharePoint 2016 box that I haven't used in a while, when I powered it on and tried to browse to the default SharePoint site at http://machinename I received the classic .net error:

Server Error in '/' Application.

Runtime Error

I also attempted to open the SharePoint Central Administration page and received the same error.

I opened the web.config for the default SharePoint site at  c:\inetpub\wwwroot\wss\VirtualDirectories\80 and searched for the word 'error' located the xml node...

<customErrors mode="On" /> and changed this setting to 'Off'

Refreshing the http://machinename page now displays the hidden error message...

'This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to a server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft Sharepoint 2016 Products.

Unfortunately, if I attempt to run the SharePoint Products Configuration Wizard it also displays an error message 'Failed to detect if this server is joined to a server farm,,,'

Turns out the SQL server was just turned off but in my environment I have many SharePoint Servers, SQL Servers, Web Servers, etc. I wasn't sure which SQL server this SharePoint machine was pointed to and I only wanted to power on this one SQL Server.

There are probably multiple ways to determine which SQL Server the SharePoint box is pointed to but the way I chose to find out was to just reference a registry key that defined the connection string to the configuration database. The key name is dsn and the Data value is populated with the connection string.



My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.O\Secure\ConfigDb




10/6/16

Connect SQL Server 2014 Management Studio to Azure SQL Database

To connect SQL Server Management Studio (SSMS) to an Azure SQL database log in to the Azure Management Portal

Create a new database or connect to an existing database

For this example I'll create a new SQL database, from Azure home page select SQL Databases and select  +Add

Select the database

After the database has been created (may take a few minutes and a refresh to appear), from the SQL databases menu select the database that was just created (MyDb).



Add a firewall rule

In order to connect to the Azure SQL database a firewall rule must be created with the IP address or range of IP addresses that will be allowed to access the database.


After the firewall rule has been created the database can now be connected to using SSMS.

Copy the server name

From the Azure Management Portal Select SQL Databases and select the MyDb database


Copy the server name listed below Essentials for your database

Determine Server Admin username for the Azure SQL Server

From the SQL Databases menu select the database (MyDb)



Select the server name link below Essentials - Note: you must have a username and password that has access to the database to connect using SSMS.


Launch the SSMS Application

Paste the server name that was copied above and enter the username and password