Deploy a dacpack using Azure CloudShell - azure

I am new to CloudShell and I want to deploy a SQL database to Azure SQL Server.
Previously (using Windows PowerShell) I have deployed a database using a dacpac file in combination with the Dac framework.
But CloudShell is something on portal & I don't have the Dac framework associated with it. Is there any other way to update/deploy database to Azure SQL Server using CloudShell?

I got the workaround for the problem. I have copied Dac framework (130) folder to CloudShell VM which contains SqlPackage.exe file.
Then I ran the PowerShell script to deploy dacpac & It works!
I am still trying to install SSTD in CLoudShell environment. But for now, I can deploy a database using dacpack.

You can actually use PowerShell in the Azure Cloud Shell through the public preview. From then, you can import .bacpac files into your Azure SQL Database as explained in this documentation page. The Dac framework is used internally by the Azure import/export module.

Related

Apply changes automatically from one azure database to another

I am trying to implement source control for database stored procedures. I am using Azure DevOps and I have added all the stored procedures to an Azure Repo.
I am connecting to the Azure Repo through the team explorer in SSMS. I am working on a branch and once the stored procedure changes are added to the master branch I want the changes to be automatically deployed to the production database.
Is this possible using an Azure pipeline?
Yes you can do it with DACPAC
You can follow the following links,
Use tools that help you integrate and deploy your database along your code. Build better apps on any client OS (Windows, Linux, and macOS) using our graphical user interface and command line tools.
DevOps using SQL Server
Continuous Deployment of SQL
The following link has step by step instructions as to how we can set up Azure pipeline to execute the changes from one database to another:
https://microsoft.github.io/PartsUnlimited/iac/200.2x-IaC-CDAzureSQLdbwithVSTSandVS.html

Is it possible to download a database to debug locally? If so, how?

When I am debugging my ASP.NET MVC 5 project on visual studio, entity framework creates a ".mdf" file. Now I need to download my app's database hosted on azure to debug locally. How can I do that?
Please read this article
Export an Azure SQL database to a BACPAC file. Here you will find how to export your database from Azure.
After that in SQL managment studio use this answer
How to restore Azure SQL Database Bacpac Local (import Azure database to your local machine) and then please use your local database which was taken from Azure

Using real Azure SQL databases on VSTS build definition

I want to run tests using real SQL databases. The SQL server and the databases would be on Azure. I'm trying to configure a build definition on VSTS where the tasks would set up an Azure resource group with the databases, set the connection strings on my solution and run the Entity Framework Core migrations to the databases. After the tests a task should delete the resource group.
I created an Azure resource group with the databases I need and downloaded the PowerShell deployment files, the script, template.json and so on.
The PowerShell script task can have an inline script or a path to the script. Should I add the Powershell scripts to the solution so that the VSTS could access them? The inline script option seems to be for small few line scripts and the Azure deployment is quite big with multiple files.
Setting up the connection strings shouldn't be too difficult. Several people suggest using the Replace Tokens task from the market place.
I'm not sure how to run the database migrations after that. Can I run the migrations on PowerShell script task? How can I ensure that the needed cmdlets work?
Since the script is quite big, you can’t use Inline script, you can add it to the project or other path of server (Add additional mapping for different path).
Regarding database migration, if you enabled EF migration in a web app, you can create a publish profile (web deploy package) with database migration enabled, then publish/deploy with /p:DeployOnBuild=true /p:PublishProfile=[profile name];DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\webEF.zip" MSBuild arguments, then deploy package to Azure Web APP through Azure Web Deploy task.

Deploy SSIS on Azure Portal

I have already tried to deploy SSIS using AzureVM and it's working fine for us. Just want to explore other options.
Is it possible to deploy SSIS on Azure Sql Service without using AzureVM? If yes, then provide some guidance.
How to connect local (on-premises) database (For example. Oracle) from Azure SQL using SSIS without using AzureVM?
No, this requires an Azure VM or an on premise installation of SSIS- SSIS as a Service is not an Azure offering at this time.
Azure SQL Database won't allow for Linked Servers and, elastic query may not fit your use case; It may not be possible to do from Azure SQL. However, you could try defining one data source for SQL Azure and one for your on-prem database (or even Oracle) within SSIS and run your report on the data that way. More about establishing data sources/connections.
Now you can deploy your SSIS package on Azure by creating Integration Run-time in Data factory which will create a SSISDB and under SSISDB, Integration Service Catalog will be available.
SSIS Project deployment is available as of now on Integration Service Catalog.
For more details and steps, click below link-
deploy-sql-server-integration-service-packages-to-azure-using-azure-data-factoryv2

SQL Azure - how to restore a demo database nightly?

We have a sandbox environment for clients to play in and we want to restore the database to a clean state every night.
I have not had any success in finding an example on how to set this up - easy to do this in a local environment using a SQL Agent Job - no idea how to accomplish this in Azure.
One way to accomplish this would be ARM template and a bacpac file. Your ARM template can be deployed with PowerShell or Azure CLI using cron.
Blog Post: https://blogs.msdn.microsoft.com/kaevans/2016/03/28/deploy-bacpac-to-azure-sql-database-using-arm/

Resources