Can't delete azure database - azure

In the sql server database list here:
https://manage.windowsazure.com/#Workspaces/SqlAzureExtension/Databases
I select a database and at the bottom is "Delete".
I press delete and it processes a little while then says:
Could not delete database 'system-50e5f905-...etc'
I follow a link for more details where it just says:
Bad Request
Extra info
They do not appear to be linked resources anywhere.
I have been able to create and delete a new database.
I have also connected using MS SQL server management studio and I can only see two named databases, none of the databases that have a name format of system-guid for a name.

Databases with the name format system-SOME GUID may be federations.
Deletion (Dropping) of a federation must be done within the database Management Portal for the main database.
Caution: I don't know the ramifications of dropping a federation, so make sure you have backups of data you don't want to loose or research this further.
From https://manage.windowsazure.com/#Workspaces/SqlAzureExtension/Databases
Select the main database
Select "Design your SQL database"
Log on
At the top you see "server > [DB] > Tables", Click [DB]
Federations are shown on this page and you can select them and "Drop Federation"

I deleted my database on Azure using "SQL Server Management Studio" , right click Delete.
using Code First with Update-Database command, it will re Created.

Related

Azure SQL Database sandbox based on production

I have a large Azure Sql Database. I need to provide a sandbox to a team that is a copy of the database, but allows them to create sql objects. The data in the sandbox needs to be up to date with production. I used elastic queries, but the performance is not ideal. I've looked at data sync, but the company requires AD authentication. Restoring production periodically as the sandbox is not ideal as the team does not want to lose their work. Any suggestions? I'm sure I must be overlooking something.
I would first make a copy the production database, then create a "From the Hub" sync group.
1. Copy Database
You can easily create a copy of an Azure SQL database by going to the database blade and clicking "Copy" in the header. From there it will ask you the new database name and target server. You can put it on the same server or create a new server, that is up to you.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-copy
Once you've done that, you now have a "sandbox" database you control which would be an exact copy of production.
2. Sync Group
After that, you can sync specific tables from production to the sandbox by creating a Azure SQL "Sync Group".
You want to initiate this from your production database since that is the source (or hub) database, so go to the database blade of your production database and choose "Sync to other databases".
Click on "New Sync Group". From there it will ask you for a sync group name which could be something like "SyncSandbox".
Select your member database(s), this would be your sandbox database, so choose "Use Existing Database" and select your sandbox database.
Choose your sync direction. This is important, since you only want to sync from production to the sandbox, select "From the Hub".
Finally you can configure the sync group. On the Tables page, select a database from the list of sync group members and select Refresh schema. Once you're done, select Save. You can also go into the properties and select the sync frequency if you want it automatic.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-get-started-sql-data-sync
The only one thing worry me that you mentioned your team want to keep their work. I dont know how it would be possible imagine you copy database and your team created new customer with new id which is lets say 31 and then same thing will happens on production so how to resolve those conflicts. If to omit this then I would recommend you to do following.
Setup database replication
Create job Logic App or Azure function which will execute command on that replica
CREATE DATABASE Database2 AS COPY OF Database1;
I am not sure but you probably will need to run command make this database writable since if you copy replica it will be read only.
Run script to replace all sensitive data.
But keep in mind that you will have down time so probably better would be to do this job every morning so when team starts they will have fresh data
More options how to COPY

How to check/view data in SQL DB in Microsoft Azure

I have a web app in azure which let user to input some data. I want to save them in sql db which I created in azure. Is there a way to check/view the entered data . I am referring to something like "mysql workbench for mysql"
You may also view the data in your browser using Azure Portal
Select your DB and then "Query editor" in the menu and start querying.
You can download sql server management studio to access your data. Also you can you Visual Studio Community Edition or Visual Code.
Below is the link for download
http://go.microsoft.com/fwlink/?LinkID=828615
you also need to configure the sql database firewall to get access to your database. A Step by Step tutorial to configure that can be found in the following URL
https://azure.microsoft.com/en-us/documentation/articles/sql-database-configure-firewall-settings/
Alternatively, you can query your database via SSMS: https://azure.microsoft.com/en-us/documentation/articles/sql-database-manage-azure-ssms/
Free to use: MSDN SSMS download page
Once connected to your database, simply right clicking on a table in the Object Explorer and selecting 'View top 1000 rows' would give you a view of - you guessed it- the top 1000 rows. You may query against the database there with any SQL query; For instance- removing the TOP 1000 from the generated query will return all of the data in that table.

Unable to create Easy Tables in Azure

I have created a Mobile App and Database in Microsoft Azure. Now I am trying to create Easy Tables from Mobile App but I am getting error message "You need database to use East Tables. Click here to create one.
Even though I have existing database Easy Tables doesn't list it.
Below is the screenshot.
I have mapped Data Connection with mobile app, below is the screenshot
It would be great if anyone can help, I am new to azure.
Your connection string must be created with name: MS_TableConnectionString
Just because you have a database doesn't mean it is linked. Click on Data Connections, then Add, then add your existing SQL database.
Note that Easy Tables won't recognize the existing tables unless you add them through Easy Tables. There are notes around the format of Id (it needs to be
a string) and other fields.
When you created your Database Server did you check "Allow azure services to access server"? That could be why you cannot see the Database listed.

Accidently Deleted Contents of Azure Mobile Service table

I was deleting a single record in the Classic Azure Portal in Mobile Services Browse. The entire contents of the table has now disappeared. Please help!!! How do I restore the contents. The table and scripts are still there.
I have gone into the SQL database tab and clicked restore from point in time, this creates a new DB but does not give me an option to restore to Azure mobile services.
Restoring a database always creates a new database on the same server as the original database, so the restored database must be given a new name. Once complete, the restored database is a normal fully accessible online database charged at normal rates based on its service tier and performance level. If you are restoring the database for recovery purposes you can treat the restored database as a replacement for the original database, or use it to retrieve data from and then update the original database. Please check this article for details.
So if you are going to use the new database, you can re-configure your mobile service to use the new database as following snapshot shows(click the mobile service, go to configure tab then click change database):

Do you know a tool with GUI to edit data in SQL Azure Federation?

I'm migrating an application to SQL Azure Federation and I d'like to see and edit the tables content without SQL (it's just for testing).
With a standard SQL database (SQL Server or SQL Azure) I can use one of these :
Management Studio (SSMS) to see and edit data : right click on a table > edit top xx rows.
Visual Studio : in server explorer, I connect to my database, right click on a table, and click on "Show table data".
Of course this doesn't work for SQL Azure Federation.
Do you know a tool (even simple), free (if possible), to edit my data in a federation member ?
Btw, you can't use Edit top xxx rows from SSMS when connected to SQL Azure database. This option is disabled (it even is not listed on the context menu).
However it works with Visual Studio (Visual Studio 2012 SQL Server Explorer) though. Which is interesting.
And it works with Federations too. Your Federation Members are actually a separate databases with some strangely generated names. Connect with VS SQL Server Explorer to the SQL Azure Server. Then when you list all the databases in the tree you shall see other Databases, beside your federation root:
Now the only thing left is for you to know which system-xxxxx database corresponds to which federation member. You may be able to find this from that article. The following query might be helpful:
-- Route connection to the federation root
USE FEDERATION ROOT WITH RESET
GO
-- View the federation root metadata
SELECT db_name() [db_name]
SELECT * FROM sys.federations
SELECT * FROM sys.federation_distributions
SELECT * FROM sys.federation_member_distributions ORDER BY federation_id, range_low;
GO
Your task is fairly easy achievable when you have just one federation with only one federation member (because you will only have a single system-xxx-xxx-x DB). But as soon as you split, you will want to find out which exact federation member database you need to talk to.
UPDATE
There is one reliable way to get the exact database name for a particular federation member. You have to connect to the federation member you want to edit data in. For instance if our Federation is named MyFirstFederation and federation distribution key name is FederationKey, and we want to connect to the federation member where data with 10000 for value of Federation key is, we execute:
USE FEDERATION MyFirstFederation(FederationKey = 10000) WITH RESET
GO
On the same context we execute:
SELECT * FROM sys.databases
GO
This will list master and system-xxxx-yyy-zzz. Where the former will be the exact database which holds members with FederationKey values of 10000 (and everything else withing the range of that particular federation member).
Now we know the exact name of the database we want to select in Visual Studio 2012 SQL Server Explorer and will be able to visually edit content. It is a bit slow though, but it is a GUI tool you are asking for.

Resources