How do I rename an Azure SQL Database?

From time to time I need to do those kind of things, so I want to keep it posted here to no to forget them.

If I need to rename a database which is in Azure Database, I have two options to do this, bot options are related with Management Studio, so keep in min to have in your laptop and keep in mind that your IP has to be allowed to connect to the database server.

Rename with command-line – TSQL

  1. Connect with SQL Server Management Studio to your Azure database server
  2. Right-click on the master database and select New Query
  3. In the New Query window type ALTER DATABASE [dbname] MODIFY NAME = [newdbname]. (Make sure you include the square brackets around both database names.)

Rename with a GUI – SQL Server Management Studio

  1. Connect with SQL Server Management Studio
  2. Make sure Object Explorer pane is open.
  3. Click on the database name (as the rename option from the dropdown will be greyed out) and type in the new name.
  4. The Azure Portal should show the reflected the change almost immediately.
Advertisement

On-Premises Gateway

We are living in a digital transformation to O365, but by the time we are doing this, our customers still need to connect their On-Premises data like SharePoint or SQL to Office 365 applications (PowerApps, Microsoft Flow, Logic Apps, Power BI).

For that reason, Microsoft has introduced on-premises data gateway for providing a quick and secure connection between on premise data and Office 365 apps.

We must keep in mind that there are two different types of gateways, one of them is On-Premises and the other gateway, is the personal gateway, which only allows to connect to PowerBI and can be used as an individual without any administrator configuration.

In the following image, we can see the differences between the personal gateway and the On-Premises gateway:

gw

Moreover, the current supported On-Premises applications are SharePoint 2016 and SQL 2016, as you can see in the diagram below, there are multiple O365 connections to On-Premises services:

aas-gateway-how-it-works.png

The installation process is straightforward, and only is needed a server with the following requirement to use the gateway:

Hardware Requirements:

Hardware Requirements Value
CPU 8 Cores
RAM 8 GB

Software Requirements:

Software Requirements Value
.NET Framework Version – 4.5
Operating System Windows 7 / Windows Server 2008 R2, or later

If you require more info about the gateway, you can follow the links:

https://flow.microsoft.com/es-es/blog/on-premises-data-gateway/

https://powerbi.microsoft.com/es-es/documentation/powerbi-gateway-onprem/

https://docs.microsoft.com/es-es/azure/analysis-services/analysis-services-gateway

How to restore local databases to Azure Databases

We are in involved in several projects with Azure, and in one of them, we need to create an Azure Database to use with an Application Web and restore some information that we have onPremises on Azure Databases.

So, as you can imagine, is it not possible to restore a OnPremises database to Azure, you have to do additional steps, so the goal of this post is to explain that process:

First, you’ll need to create a SQL Database in Azure:

untitled

Give a name for the database. Once it is created, you will see the servername listed in the dashboard:

untitled1.png

So, we need to start the SQL Server Management Studio and connect to the Azure database, entering the server name and Login credentials:

untitled2.png

In SQL Server Management Studio, will now be listed the database created:

Sin título

Next Step is to connect to the Local SQL server instance and generate the scripts:

Sin título1.png

The script generator will now start. In this instance I have selected to script the entire database

untitled4

Before you create the script, click on the ‘Advanced’ button

untitled5

Under the advanced options, be sure to select to script the database for SQL Azure

untitled6

In my example, I chose to only script the schema but you can script the schema and or data

untitled8

After you are done, create the script

untitled9

Next step is to select Azure database in Management Studio and execute the script file you have previously generated

untitled10

Hit f5…

untitled11

After doing this, the schema will be created in the Azure database

untitled12

Easy, isn’t it?