Database Schema Migration on Azure with Git Deployment - database

I am looking for a means to use Git deployment on Windows Azure together with either their MySQL or other database solutions.
I need a means of migrating database schema changes as part of deployment - does Azure provide support for this without using Visual Studio or .NET.

You basically want to use Azure as a Continuous Integration (CI) platform and my view is that Azure by itself just isn't there yet.
A basic git based CI scenario would involve the following steps.
Your src code and any database schema/data updates are pushed to a central git repository like GitHub. [Feature available]
GitHub would then push the updates to Azure. [Not supported in Azure until they support GitHub hooks]
Azure compiles and deploys the code. [Supported]
Azure updates the database from sql files pulled from the repo (remember, this needs to be automated). [Not supported]
Azure reports any error in running the database or web application. [Supported]
Azure runs user provided integration tests to check more thoroughly specific functionality and reports the status of those tests to the user [Not supported].
Azure allows you to roll back to a previous deployment snapshot [Partly supported. Snapshots are not based on git commits for instance].
I might be wrong on some of those points or new features might be added since I've written this. Corrections are very welcomed and I'll try to update the list accordingly.

I am not sure how much experiences you have with Windows Azure Websites, however when you are creating a Windows Azure Websites, you have ability to use SQL Azure Database or MySQL cloud database directly integrated with your Windows Azure Websites.
So if you will use SQL Azure Database then there are several ways you can migrate your DB following the link here:
Migrating Databases to Windows Azure SQL Database (formerly SQL Azure)
To manage MySQL you can use Local Web Server to do it. The way I have done is to use PHP, the MySQL Command-Line Tool (part of MySQL), and a web server set up on my local machine, and that I have enabled the PDO extension for MySQL. This way I can manager my MySQL directly from my own local machine and the details are explain at the bottom of this article:
Create a PHP-MySQL Windows Azure web site and deploy using Git.
Also the SQL part you can write in Workbench if you use MySQL and Oracle SQL Developer if you use Oracle SQL.
Finally Git Deployment allows you to deploy your any kind of application directly to Windows Azure without using VSx.

Related

Why do I need SQL Server to install Azure DevOps?

I'm currently working on a enterprise that uses TFS 2017, and we pretend to upgrade to Azure DevOps. So far I'm just studying about how to implement this TOOL. I'm new on devops things and I have these following doubts... Why do we need SQL Server to install DevOps Azure? What kind of information are stored in there?
In the server configuration wizard, I have the option to select an existing database to use for the Azure DevOps Server that's being deployed... Can I select the currently database that's used by TFS 2017?
Azure DevOps Server and Team Foundation Server store just about everything in massive SQL Server databases.
The main server configuration is stored in the tfs_configuration database and each project collection is stored in a separate database The default is tfs_defaultcollection.
The collection database holds all version controlled files (TFVC and Git), all work items (Product Backlog, Sprints etc), Test Cases and all test run attachments, your Pipelines, Builds and Releases as well as all of the artifacts produced by these pipelines.
These databases can grow considerably.
Whether you can keep your current database server depends on what version you're currently running. SQL Server 2016 SP1+ happens to be supported by both Azure DevOps Server 2020 as well as Team Foundation Server 2017. You could keep using that for the upgraded installation.
But my recommendation would be to install SQL Server 2019, you'll get all of the performance and security benefits of the new server, support for the latest Windows Server platform, as well as a support window that matches your new Azure DevOps Server installation.
You can find the SQL Server compatibility matrix for TFS/ADS here:
Azure SQL Database and SQL Server
TFS 2017 was one of the last versions to require a database for the Warehouse, which is a form of replicated data. Reports can be written to pull data from the warehouse, without impacting the user experience. The database is somewhat deprecated now, especially for reporting. Microsoft promotes the use of the API to pull data from the live database. TFS does however still need its "live" database to store all of the data presented to users. These will be work items, discussion comments, project templates, user mappings to AD, amongst other things.
You will need to upgrade your 2017 Schema to conform to the new standard as defined by Azure, which will be taken care of as part of the upgrade.
What kind of information are stored in there?
Issues, templates, build results, lots of things.
Can I select the database that's used by TFS 2017?
Yes, that will be upgraded during the installation.

How to create SQL Server Version control in Dev Ops Azure

I am a 1 man team, more dev's coming on board, I have created a few on Premise SQL DBs; I have a Azure SQL DB managed instance and Azure Devops account setup
Currently:
I use SSDT -->Tools--> SQL Server: to manage the data and Schema comparisons , make sure it is in sync, On-Premise and Azure managed instance (as a backup at present, managed instance is not used for anything else)
I want to do
To manage the code for multiple devs,
I want to setup Azure SQL DB managed instance as production
SSDT or Git hub for version control(manage check-in / check out of SQL objects, we are all in sync)
Local on premise version as the development area, sync in with prod, use TFVC (SSDT) as tool to manage
the code conflicts , make sure all devs are working off the same DB
Q: Can I link my on premise SQL DB to DevOps source control , then links to SQL Azure managed DB? Can I do this with SSDT / GIT hub or do I need both?
Any step by step tutorials to set this up? In SSDT I am connected to my on premise SL db and to DevOps Repo , finding it difficult to figure out how to establish the link between the two
Getting overwhelmed with all the acronyms and 101 different products you can use (state based approach, DACPAC files, YAML , arm template , octopus deploy, redgate, dacfx,)
Cannot find anything online so far to show me how to setup from the ground up
Q: Can I link my on premise SQL DB to DevOps source control , then links to SQL Azure managed DB? Can I do this with SSDT / GIT hub or do I need both?
You have to install a self-hosted agent to access your on-premises instances
Then the pipeline flow can be built this way:
Build DacPac -> Deploy to Test (On-Premises) -> Deploy to Managed Instance (Prod)
Other points:
Since you are starting a new project, consider to use YAML pipelines.
Also, SSDT, starting VS 2019, is not suitable anymore for free use in a commercial environment. You have to get Professional or Enterprise license.
As the alternative, cross-platform Azure Data Studio + Database Project add-on
And some of the concepts blogged by me earlier:
https://www.alexvolok.com/2020/azure-devops-sql-server-dba-creating-database-project/
https://www.alexvolok.com/2020/azure-devops-for-sql-server-dba-automating-deployments/

Strategy for Data Access Layer development that escalates from sqlite to SQL Azure

I want to start a rather big project (in the end). My tool of choice is basically ASP.NET MVC/WEB Api.
I would like to develop this in the beginning by using SQLite or SQL Developer edition.
Then when i go live i would plan to go to a shared hosting by using SQL Server 2012/2014 instance.
My target is that if everything is ok to convert to cloud and Azure.
So my plan that i would like to enhance/verify is:
Frontend:
Since my knowledge of AngularJS/Knockout e.t.c is lomited. I will start by using the normal Jquery/web API approach and gradually i will conver tot latest best practices and standards.
Backend:
Program to an Interface. I will have an interface for my DAL
Implement different interface for my different cases (sqlite/sql server/azure e.t.c)
In order to get a fast start to building it i would start with a good domain class design and then head to SQLite in combination of a light ORM (Dapper) in order to have my logic up and running fast.
This post: SQl Azure offline , suggests that i could start developing for sql azure right away, but i don't know if i can afford from the beginning to go to azure.
Sql Azure is basically the same as Sql Server 2014. If you start with the free SQL Server Express edition then you will have very few problems moving to SQL Azure later, especially if you use a tool like the SQL Server Migration Wizard and pehaps setup a free Azure trial account so you can test as you go?
You can just use your local Sql edition as mentioned by #Neil Thompson, If you are using SQL Server Database Project, there is an option to target your deployment to SQL Azure database instead of full version of Sql Server,
I have been using above option without much problem.
Sql Federation in Azure which is I think the only major non-supported feature in on-premise/local Sql edition that you would need Sql Azure for day-to-day development/testing.

Getting started with Microsoft Azure development

I just started developing in Azure and I bump in to a lot of questions that might help others as well.
My goal is to learn more about:
azure
html5
jquery
ASP.NET MVC4
entityframework
My first steps:
subscribing to Azure. (5 minutes)
create a website, and added a database to my azure account. (5 minutes)
create a TFS environment (5 minutes)
download the publish settings file that can be used in visual studio to publish directly into azure (1 minute)
installed visual studio 2012 (2 hours) (required)
installed azure SDK for .NET (30 minutes) (required)
installed resharper (30 minutes) (optional)
installed SQL server 2012 (still downloading, 1 hour and counting) (needed?)
I started in parallel and began with this great tutorial for getting hands-on experience with website, html5, azure.
Since I deviated from the tutorial by adding my entity classes in a different project I ran into errors running enable-migrations. Here you can read the answer to that problem.
Now the "toughest" part for me until now: tha world of databases.
I am no expert on database development so I was wondering how deep do I need to dive. The goal remains the same: I want to build a webapp where I store and retrieve data from a database. So far the azure experience is quite easy going and everything integrates pretty easily.
I kinda liked the idea that I only need visual studio to work from, and that I can get addins that help me develop the things that I need.
Does that end when you get to database development?
Is SQL server 2012 the way to go?
Or are there "more easy" alternatives?
Is it a lot of work to update the database in the cloud with the stuff that I changed locally?
I do want to store stuff in the database in azure in the end.
Can you folks shed some light on the possibilities there are out there with its cons and pros?
When you work with windows azure environment in emulated environment (local development) You can use desk top version of SQL server 2012.But at the end you have to store your data schema on Azure SQL Database when you publish your cloud Application for production.
What is Windows Azure SQL Database ?
Microsoft Windows Azure SQL Database is a cloud-based relational
database service that is built on SQL Server technologies and runs in
Microsoft data centers on hardware that is owned, hosted, and
maintained by Microsoft.
Similarities and Differences
Similar to an instance of SQL Server on your premises, Windows Azure SQL Database exposes a tabular data stream (TDS) interface for Transact-SQL-based database access.
This allows your database applications to use Windows Azure SQL Database in the same way that they use SQL Server.
Because Windows Azure SQL Database is a service, administration in Windows Azure SQL Database is slightly different.
Unlike administration for an on-premise instance of SQL Server, Windows Azure SQL Database abstracts the logical administration from the physical administration; you continue to administer databases, logins, users, and roles, but Microsoft administers the physical hardware such as hard drives, servers, and storage.
This approach helps Windows Azure SQL Database provide a large-scale multi-tenant database service that offers enterprise-class availability, scalability, security, and self-healing.
Because Microsoft handles all of the physical administration, there are some differences between Windows Azure SQL Database and an on-premise instance of SQL Server in terms of administration, provisioning, Transact-SQL support, programming model, and features.
Features and Types
Windows Azure SQL Database does not support all of the features and data types found in SQL Server.
Analysis Services, Replication, and Service Broker are not currently provided as services on the Windows Azure platform.
Because Windows Azure SQL Database performs the physical administration, any statements and options that attempt to directly manipulate physical resources will be blocked, such as Resource Governor, file group references, and some physical server DDL statements.
It is also not possible to set server options and SQL trace flags or use the SQL Server Profiler or the Database Tuning Advisor utilities.
Windows Azure SQL Database supports many SQL Server 2008 data types; it does not support data types that have been deprecated from SQL Server 2008.
For more details you can follow below mentioned links.
Windows Azure SQL Database Overview
Tools and Utilities Support (Windows Azure SQL Database)
Guidelines and Limitations (Windows Azure SQL Database)
Deploying an ASP.NET Web Application to a Windows Azure Cloud Service and SQL Database
I hope this will help to you.

How to install a custom desktop application database to SQL Express?

I have a WPF desktop application that uses a custom database for storage.
I need to prepare a setup project (from Visual studio 2008) (full setup, not ClickOnce).
I can add the to the list of prerequisites to the application and it does install during the setup of the application.
My question is: How can I run a script during the setup to create the database that the application needs? OR how can I restore the database to the client machine during the setup?
Another related question, what would happen if already exists on the client machine? How to detect the instance name and connection data? And then how to be able -if needed- to change the Connection string used by Entity framework to connect to that database?
Thanks,
Ed
SQL Server Express Edition is generally a really poor choice for a local database. It's a server-class engine that likes to use a lot of resources and runs as a service (so it's using up those resources even when your app isn't running). In other words, it belongs on a server.
The only place I've seen SQL Server Express used on a desktop that almost makes sense is as part of the Microsoft Small Business Accounting app, and in this case you generally install that program on a machine who's primary purpose is doing the accounting for your business.
What you should do is use a desktop or in-process class engine like SQL Server Compact Edition, Sqlite, or even Access. This will also greatly simplify your deployment.
If you insist on pushing through with this, know that the installer will create a new instance of sql server on the system. SQL Server will be fine with this. However, you'll need to account for that in the connection string of your app, and that can be a little more complicated. Additionally, to set up the database you have a couple options:
Create it from client code on first start of the app
Create it with a custom installer action (hard to get right because msi permissions)
Distribute an pre-build *.mdf file and attach with custom installer action or on first start of the app.

Resources