Error Migrating SQL Server Database to Azure - sql-server

So I am completely new to .Net Core development, and was given a codebase that I am trying to host on Microsoft Azure. I have the local database file (.mdf) in SQL Server Management Studio, and am trying to deploy it to an Azure Database, However it keeps failing during migration and giving me this issue
Error SQL71627: The element User: [ISOCENTRIC\Administrator] has property >AuthenticationType set to a value that is not supported in Microsoft Azure SQL >Database v12.
(Microsoft.SqlServer.Dac)
However, when I SELECT * FROM master.sys.database_principals; and it dumps the db users list, the "ISOCENTRIC\Administrator" user does not appear in that list, so I cannot find a way to drop it from the DB. Is there something I am missing regarding the location of this user and how I can drop it from the db so I can migrate to Azure?
p.s. This is my first post on here so please let me know if I should make any changes to adhere to correct formatting on this forum.
Thanks in advance.

I guess the database users can't be migrated to Azure SQL DB because they are Windows users. You'll need to drop those users before you deploy this database to Azure SQL DB.
You can always backup and restore a copy of this database, remove the users, and then deploy that one to Azure SQL Db.

I figured out that my query to dump the database users was incorrect, and was able to find and drop the user causing the issue.

Related

Restore .bak on Azure SQL database through SSMS: Failed to connect to Server ***. Login Failed for user ***

I am trying to restored a .bak file on an Azure SQL server through SSMS.
The reason why I am doing this is that my company unfortunately blocked any action on the Azure portal itself and therefore I have to find another way around.
I am able to connect successfully to the DB on Azure with my admin account through SSMS.
I first successfully restored the .bak on my local database. And then I am trying:
Again, I am able to connect through the same SSMS to the SQL db.
Moreover, when starting this procedure I get asked to connect first to the DB, which works successfully! What I mean is:
It doesn't give me any error, which is weird because if I try to connect with a wrong password it tells me right away that is wrong. So it kind of accepts it. It's only after when I really start the deployment that it gives me the problem:
Just for now, Azure SQL database doesn't support restore from .bak file.
You work flow should be right, restore the .bak file(database) into a local SQL Server firstly, then deploy the restored database to Azure with "Deploy database to Microsoft Azure SQL database".
Make sure you are using the server admin account of the Azure SQL database. Per my experience, the error is usually caused by the permission limits.
If all of these(SSMS) don't work, please thy other ways. Please try Data Migration Assistant(DMA) migrate the database. If DMA still give the same error, we can ensure that it's not caused by the tools, you need another higher Azure SQL database account permission.
HTH.
Working solution was to use the export data task:
For some reason this worked and the publish to ASQL task from SSMS didn't. I understand this is very based on the restrictions imposed by my company but at least this solution worked.
NOTE: as both Source and Destination use SQL Server Native Client .
Moreover when setting the Destination the refresh of the list of databases might not work (depending on your permissions on Server level) but if you type directly the name of the database it will work. Talking about this:

Error SQL71624: The permission 'CONNECT' is not valid for the target object 'guest' in Microsoft Azure SQL Database v12

I have a SQL database created and I am trying to deploy/move that database to the Azure Cloud by using the Deploy Database to SQL Azure Wizard in SQL Server Management Studio. But I have ran into an error after trying to deploy it. I am using the SQL Authentication to log in with my credentials. I also tried installing the Data Migration Application.
The error is:
TITLE: Microsoft SQL Server Management Studio
One or more unsupported elements were found in the schema used as part of a data package.
Error SQL71624: The permission 'CONNECT' is not valid for the target object 'guest' in Microsoft Azure SQL Database v12.
(Microsoft.SqlServer.Dac)
BUTTONS:
OK
I don't understand what this error means and also I don't understand why this error is happening. I looked on the internet for possible solutions but could not find any information. Please help me.
SQL Azure and regular SQL Server aren't entirely compatible.
One of the things that is enabled on regular SQL Server is the guest login. This login allows connection to instance, with a default database of master. Once connected, the user can switch to a different database (use [thedatabase]) if they have the authority to do so.
But in SQL Azure, you connect directly to a single database, and can't switch databases on the connection. So the guest account has no function.
On your source instance (the one you want to migrate), you can revoke this ability so that the wizard won't try to migrate it. Execute revoke connect from guest on your on premise instance.

How to resolve Azure data Migration blocker User: has an unresolved reference to Login

II am migrating an existing SQL Server 2014 DB to Azure. Always failing so I ran Data Migration Assistant to Assess the DB compactibility and I get this result.
Cannot still figure out how to solved that.
User: [eAgricDBUser] has an unresolved reference to Login [eAgricDBUser].
The error occurs because it's referring to logins that existed in the source SQL Server instance but not in your target Azure SQL DB instance (logical master).
Suggest you think about how your users should access the database now that it is in Azure SQL DB. Contained users are helpful here as they can be moved around to any server and still function. AD users are even better but you'll need to have your on-premises AD integrated with Azure AD. Both save you lots of headaches with login migrations.
Alternatively, you can create the required logins in master before you run the database migration scripts which contain create user statements. Note that you will be creating them with a new password so you will need to provide that to the users plus you'll need some way for the users to change that to their own password.

Azure SQL Database Corruption - Cannot delete with error 40613

We have a windows service that provisions Azure SQL databases for our clients. We are using Microsoft.WindowsAzure.Management.Sql API for this. Our service creates the SQL Server instance and deploys the schema using a DACPAC.
When running recently we received the following warning during the DACPAC deployment step:
Warning - Database 'AG61_xxxxx' on server 'xxxxxx.database.windows.net' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of '{xxxxxxxx-C7D7-4504-AF25-4C3AC020BE90}'. (73144)
The problem we have is that this database is now left in an inconsistent state:
It isn't listed in the Azure Portal under databases.
The Azure API doesn't return it in list of databases on the server.
Attempting to recreate the same database on the same server, either via code OR via the Azure Portal, returns
Database 'AG61_xxxxx' already exists. Choose a different database name.
However, I can log into SSMS as the admin user and see the database listed. If I try to delete it I receive the following error:
Failed to connect to server. (Microsoft.SqlServer.Smo)
Additional information:
Database 'AG61_xxxxx' on server 'xxxxxxxxxx' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'FBE26206-C3B6-4771-B0EF-4BCA9C154F28'. (Microsoft SQL Server, Error: 40613)
According to Microsoft, error 40613 is transiant and should only last a few seconds. We've been unable to do anything with this database for 3 days.
Has anyone else experienced this? I'd like to know if there is something we can do to recover the database on this server such that we don't have to have the client change their connection strings etc.
I'd also like to know if there is anything I could do in future to mitigate this happening again.

How do I publish SQL Server Database to Azure to update existing database

I publish my SQL Server database on my local machine to Azure via Management Studio.
Say I name the database on Azure "California". The first time I do it its ok.
Then I made changes on my database on local, adding columns, adding data, etc. Then I want to deploy this database to Azure again.
But now Management Studio won't let me do it. It says database "California" already exists on Azure.
I can get away with this problem by deleting existing "California" on Azure first, then deploy again. But this seems not correct...Every time I make database changes on local, I need to delete the one on Azure before I deploy?
Does anyone know how to solve this problem?
The best way is to create a database project in Visual Studio to maintain your database schema and then you can do a database compare to create a script to update the database on Azure.
http://weblogs.asp.net/gunnarpeipman/archive/2013/01/28/using-visual-studio-database-projects-in-real-life.aspx
RedGate Schema Compare will also do a similar thing.
Update Jan 2020
(I'm assuming the question is to update the schema on Azure, not update data)
If you are using Code First for creating your database. Then it is really simple.
Assuming your connection string is pointing to a local database (the one you want to update to Azure)
Make the changes to your entities
Create a new migration for those changed (Add-Migration etc)
Update the migrations to your local database.
Now just change the connection string to point to your Azure database
Update the migrations again, which will now update to the Azure database
Voila! That simple
I know its been a while since the question was asked, however, there is no accepted answer. Thus to aid anyone coming here with a similar issue the following link describes a number of methods.
I prefer deploying a SqlDb from SQL Management Studio
http://azure.microsoft.com/en-us/documentation/articles/sql-database-deploy/
How to: Deploy to SQL Database
In Management Studio, connect to an on-premises SQL Server instance that has a database you want to migrate.
1) Right-click the database --> Tasks and click Deploy Database to SQL Azure.
2) In Deployment Settings, enter a name for the database.
3) Click Connect.
4) In Server name, enter the 10-character server name, followed by .database.windows.net.
5) In Authentication, choose SQL Server Authentication.
6) Enter the administrator login name and password that you provisioned when creating the SQL Database logical server.
7) Click Options.
8) In Connection Properties, in Connect to database, type master.
9) Click Connect. This step concludes the connection specification and takes you back to the wizard.
10) Click Next and click Finish to run the wizard.
If you are using SQL 2012, you can export a data tier application (bacpac) file, then import that when you login to your SQL Azure instance.

Resources