Capture Azure VM Image with SQL Server - sql-server

I have followed these steps https://www.windowsazure.com/en-us/manage/windows/how-to-guides/capture-an-image/ to capture an image of a VM. Used sysprep as mentioned and I was able to replicate the VM. The problem is that when I rdp into the machine, I can't connect to SLQ Server. Login fails for Windows Authentication. Usually this means that the SQL Server is on another domain, but in this case the error is on local machine.
So my question is, how to capture an image of a VM with SQL Server in Windows Azure and ensure that I can login with Windows Authentication at least when deployed?

I don't think you can, I think you will need SQL Server Authentication before sysprep (I haven't tested this), as far as I know this is the same on-premises and not an Azure feature per se...
If you run sysprep on Windows, you shouldn't have any expectations that the current principals provisioned in SQL Server will continue to work. SQL Servers references Windows accounts by their SIDs and running sysprep on Windows will create a new set of SIDs for the Windows account. Therefore, you will have to re-add them to SQL Server as you've discovered.

Adding a solution that worked for me, in case anyone facing same problem and haven't found any working solution.
After creating an Azure VM from the Image based on a generalized VM (sysprep run):
Launch SQL Server Configuration Manager.
Navigate to SQL Server Services.
Right click on SQL Server (SQLEXPRESS)->Properties from the right side panel.
Select 'This account:' and enter details of current VM Administrator credentials.
Apply changes and restart SQL Server.
Now, try connecting to the SQL Server. It should work.

Related

Get SQL Server database server address

I am installing an app and I am at the point where I am supposed to provide the server details. I installed SQL Server Express and I also installed SQL Server Management Studio.
This is the screenshot:
I did execute this command
select ##servername
but I got this response:
I am running this on my local machine. How can I find the database server address and also the server password?.
PS: I do not remember setting any password when installing SQL Server.
Thanks.
When you executed the command select ##servername, how were you connected to the server? Running that command required knowing the servername and authentication of some kind. I'm guessing you were connected to DESKTOP-KOJLCIF\SQLEXPRESS or .\SQLEXPRESS using windows authentication.
When you installed SQL Express, there was an option for Windows Authentication or SQL Server + Windows (aka Mixed Mode) Authentication. If you chose Windows Authentication (which is the default if I recall), you will not have SQL Server usernames or passwords.
The app you are installing appears to required SQL Auth, so you need to pick Mixed Mode in your setup (which allows both Windows Auth and SQL Auth). You can find this setting in recent versions of SQL Server Management Studio by right-clicking your database server in object explorer, going to Properties, and then looking at the Security page. Older versions of SQL require going to another tool included in the installation folders-- server configuration or some such, the name escapes me. Change the authentication to "SQL Server and Windows Authentication mode". I believe a SQL Server restart is required after doing this.
You can then create SQL logins with username and passwords and appropriate permissions using the GUI in SSMS (expand security folder under your server and look at the logins sub folder) or via CREATE LOGIN t-sql command.
There is a fixed sql login called 'sa' that will always exist if SQL Auth is enabled. You could right click this login, go to properties, and change the password. Be careful giving out your sa credentials to an app, as that can control the entire server.

Connection to SQL Server using Windows Authentication from an application started as service

MSSQL server is running with Windows and SQL Server Authentication mode on a server called 'HOST1'. The application which needs to connect with the SQL Server is started as a service on a server called 'HOST2'. Since the service manager starts applications as the user "NT Authority\System", I'm unable to connect with the SQL Server on 'HOST1' from 'HOST2'.
I have the option of manually changing the user account using which the services are launched. That is,
Right click service -> properties -> Log On -> Choose 'This Account' -> Provide a user which has permission to connect with SQL Server in 'HOST1'
But the problem is, there will be hundreds of services, running in hundreds of hosts. Hence modifying the user manually for all services is not possible in my case.
Please let me know how I can connect to SQL Server.
Would using Powershell to script out a solution that is not quite as taxing? Maybe as part of the deploy process?
Powershell script to change service account

SSAS Cube deployment error

I was going to process the cube deployment and found the error.
I changed the target server name from 'localhost' to this,and tried different way but in vain.
Here is the snap from my SSMS
You may have multiple issues going on but the first and foremost is you do NOT deploy SSAS Multidimensional [MDX] models to a SQL Database Engine Instance!
Unless you have a very odd configuration ATI-PC\MSSQLSERVER should point to the default MS SQL Server Database Engine Instance NOT an SSAS MDX instance!
The SSMS screen shot you show is for the local host connection you show is for a Database Engine with SQL Server Authentication (SA), which I would assume the instance is called MSSQLSERVER which is the default instance name.
1) What is your SSAS instance name?
2) Does your windows account have permissions? SSAS doesn't allow for SQL server authentication so it must be windows authentication.
3) Is SQL Browser running?
4) Have you configured SQL Browser to allow for the protocols and to allow connections from both Localhost and ATI-PC(InstanceName)?
to connect to Analysis Services Change the Server Type. When first launching SSMS you can do that via changing server type and then modifying the server name to the appropriate name.
If your SSMS is already open you can select "Connect" drop down and choose Analysis Services.
Check on your SQL Browser Configuration by Launching "SQL Server (Version) Configuration Manager" then step through the different areas as far as how to configure it is somewhat self explanatory and because you are deploying an AdeventureWorks cube I would surmise that the configuration would be earlier in you tutorial you are working on.
I am sure that you have 'SQL Browser' service running in services.msc. Still I doubt your account which you logged in has access to SSAS and also to connect to that underlying SQL Server. Try checking both for the access, if you selected deploy as service account check that account has access in SSAS. If still you have issues trying checking the eventvwr if you are getting any more errors. If it is development box try recycling SSAS services and try deploying?

SQL Server 2012 Integration Services failed when connecting thru SSMS

I had recently installed SQL server 2012 and I used mostly the default settings. Database works fine and I can happily connect using SSMS (SQL Server Management Studio) but when I connect to the Integration Services Server I get this message
Connecting to the Integration Services service on the computer
"localhost" failed with the following error: "Access is denied."
By default, only administrators have access to the Integration
Services service. On Windows Vista and later, the process must be
running with administrative privileges in order to connect to the
Integration Services service. See the help topic for information on
how to configure access to the service.
here is the screenshot
I am not sure why but I am the domain admin and have full rights over the server. Also why when I connect from my Desktop it can successfully connect, only if I connect from the server itself which gives me this issues. How do I fix this so that I can make SSMS on the server connect to its Integration Services instance.
As I understand it, User Access Control, or UAC, can basically intercept requests for your group membership so in this case, it appears it was preventing your membership getting passed to SQL Server.
Others have noted in their comments that you may still need to right click and run SSMS as an Administrator.
As noted by an astute observer "This is a quick-fix, not a real solution. People shouldn't just be running stuff as administrator. These security walls are in place for a reason" And I agree. UAC is designed to get Windows users into a Principle of least privilege mindset - only escalate to a powerful account when required. The issue is that SSMS is known to not "play well" with UAC. As I see it, this leaves you with three options
You can turn off UAC and get your work done
Leave UAC on and tell your boss you are unable to work
Write your own query tool that is not affected by UAC
Go to all programs Click on Microsoft SQL Server 2012 folder Right click on SQL Server Management Studio Click on Run as Administrator
This should take care of problem for now. (With this you need to always repeat the same process). To avoid this every time and for a more persistent solution you need to get permission(s). Please do the following process and you should be good.
In previous versions of SQL Server, by default when you installed SQL Server all users in the Users group had access to the Integration Services service. When you install the current release of SQL Server, users do not have access to the Integration Services service. The service is secure by default. After SQL Server is installed, the administrator must grant access to the service.
To grant access to the Integration Services service
Run Dcomcnfg.exe. Dcomcnfg.exe provides a user interface for modifying certain settings in the registry.
In the Component Services dialog, expand the Component Services > Computers > My Computer > DCOM Config node.
Right-click Microsoft SQL Server Integration Services 11.0, and then click Properties.
On the Security tab, click Edit in the Launch and Activation Permissions area.
Add users and assign appropriate permissions, and then click Ok.
Repeat steps 4 - 5 for Access Permissions.
Restart SQL Server Management Studio.
Restart the Integration Services Service.
(Source MSDN)
I hope this will help
Right Click on the Sql Server Management Studio and select Run as Administrator and try to connect
if it is installed on the local instance
You should check to see what user the SSIS Service is running under. Go to Start > Run > Type "services.msc" and scroll down to the SQL Server Integration Services 11.0 entry. Right click and check the properties to find out what user it's running under. The second tab should be the LogOn tab. Since you're just running on a local instance, you can set your user as the LogOn User account and SSIS will have the same permissions that you do.
Lost a day of work on that problem. My package has a .NET script task to copy file from a shared network folder to a local folder and I was stuck with the "access denied" exception every time I tried to execute the package from the server (Through SQL Studio). The package works fine when running locally.
Tried many things picked up here and there and at the end of the day what worked is to create a Job (owner is sa) which execute the package as SSISExecutor.
I have to mention that the file on the network has read access for everyone, and that I still don't understand what was wrong.

Amazon EC2 Instance - How to find SQL Server Password

I have created an Amazon EC2 Instance that provides Windows Server 2008 with SQL Sever 2008 pre-installed. Now in order to use the SQL Server for creating databases, or restoring backups of the databases that I have on my local machine, I need the "sa" password for SQL Server 2008.
I have tried using the following but with no luck:
sa
password
"blank password"
"same password as the admin password for my EC2 instance"
Could someone please guide me as to how to get started with using the Amazon EC2 Datacenter with respect to the "sa" password.
Thanks
A bit of an update as of 2010-07-01, using a fresh Amazon image of Windows 2008 Datacenter (with SQL Server Express), SQL server was running, but the sa account was neither enabled nor with a known password. Follow these steps to fix it:
Use SQL Server Management Studio to connect to your data base server using Windows Authentication (Administrator user, for instance).
Expand the Security and Logins groups.
Open the sa account.
On the default screen ("General") set a new Password as you see fit.
Select the "Status" screen on the left.
Set the "Login:" option to "Enabled".
Click the OK button.
Right-click the root node (this will name your SQL server) and select Properties.
Select the "Security" screen on the left.
Set "Server authentication" to "SQL Server and Windows Authentication mode"
Restart the SQL Server service.
Enjoy your new-found sa access! (finally)
On a fresh Amazon EC2 "small" instance, as of 2010-05-31, the SQL services are disabled by default.
Fix: Enable any service starting with "SQL".
"Start..Administrator Tools..Services".
Select every service starting with "SQL", set the startup type to "Automatic".
Start every service starting with "SQL".
Some services will refuse to start, don't worry about this.
Now, you can go back into "SQL Server Management Studio", and everything will work nicely.
Update
2010-05-31. I tested the instructions above, with a fresh Amazon EC2 instance with SQL Server installed, and everything worked just as I described.
Update
2010-10-07. The real reason Amazon EC2 disables SQL Server, by default, on a small instance is that it doesn't actually have enough RAM to run things properly. I'm not even sure why they installed it in the first place. From bitter experience, I'd recommend that you run MySQL, given the choice, as its faster and lighter, or upgrade to a decent sized instance.
Update
Another reason why SQL is disabled, by default:
I'm pretty sure they they want to avoid being "that" company that lets loose another
"code red" or "sql slammer" worm - #Dan Esparza
RDC to the server under Administrator and connect to MSSQL instance using Enterprise Studio, using trusted connection. Then go to Security and set sa password to what you need it to be.
The short answer for how to get into SQL Server is you must RDP to the server using the Administrator account for that server (not a domain admin) and then connect to SQL using Windows Authentication. From there, you can then enable sa or add any other accounts.
When running the Microsoft SQL Server Management Studio, make sure you run it as administrator even if you have administration rights.
You could not view the password directly as it would be present under syslogins in an encrypted format.
But, You can reset the pwd.
Login to SSMS with "Windows Authentication" --> Expand "Security--> Logins"
Under "Logins", Select the appropriate LoginName and open the properties window. There you can Provide a new Password to your login.

Resources