Wednesday, October 22, 2014

I'm Speaking at Modern Apps LIVE! (LIVE! 360) Orlando

I'm excited to be speaking at the upcoming Modern Apps LIVE! conference co-located at the Visual Studio LIVE!, LIVE! 360 Orlando conference November 17-21. There are still a few days left to save $600 using my speaker registration code: LSPK17 Click on the banner below to go straight to the registration page.



Here are the Modern Apps LIVE! session I'll be speaking at during the conference:

MAH05: Building a Responsive Single Page App
MAF01 Workshop: Modern App Development In-Depth: iOS, Android, Windows, and Web

I hope to see you there and don't miss out on the registration savings that end 10/24!

Wednesday, October 15, 2014

Fixing the "Authentication failed" Message When Accessing a TFS-Git Repository

Recently I've been working with a TFS Project using Git as the source control provider and something locally has gone wrong and I just couldn't remedy in VS.NET directly. The buzz and consensus already seems to be that managing your Git repository with one of the following tools is easier and more powerful than VS.NET IDE integration:
  • Git Bash
  • Git for Windows
  • TortoiseGit
  • SourceTree
  • Git Gui
I have used Subversion in the past so TortoiseGit was familiar already to me, but the others were not too hard to test out as well. The main goal of what I needed to do was a simple Git Pull to update my local repository to the most current version. I'm using a Windows LiveID to authenticate to the TFS Online Project just fine in VS2013 and made the original clone successfully.

VS2013 initially had no issue doing a Pull, but once things got messed up I decided to use an external tool to fix the problem. The issue is all the tools kept failing authentication with the following error in some flavor below. It didn't make sense because the credentials I was providing worked previously.

"Authentication failed"

Note - it's know that the VS IDE integration with Git does not expose all the functionality available, so if you get into a mess with your repo its probably not going to be easy to fix from VS.NET's tooling. 

It turns out the solution is to modify a setting on your Windows LiveID account to 'Enable alternate credentials'. You can reach this setting by clicking on your user name in the top left-hand corner once logged into your Live account, selecting 'My Profile', and then selecting the 'Credentials' heading.

Here you will need to click the link to 'Enable alternate credentials' and fill in a password, and secondary username if desired or if the application you use can't use an email address for a username:


This allows the use of basic authentication credentials and fixes the authentication issue with the tools I listed above to manage a Git repository. Make sure to use these credentials when authenticating and you should now be able to manage your TFS-Git repository without authentication issues.

Wednesday, October 8, 2014

How To: Export a SQL Server Database to Windows Azure

If you are beginning to work with Windows Azure and are ready to deploy an application or service, you may begin to wonder how to export that existing backend SQL Server database as well. 

The good news is it's quite trivial to do by using SQL Server Management Studio and the Windows Azure Management Portal. For this example I'm going to use local my 'BowlingStats' SQL Database that is used with my BowlingSPA application to export to Azure.

Prerequisites
  • Obtain a Windows Azure Account

1. Create a Storage Account

Once logged onto the Azure Management Portal, select 'Storage' from the options on the left, and then from 'Data Services' -> 'Storage,' select the 'Quick Create' option. Enter a URL for the name of your storage account as well as a location and replication strategy. Normally Azure will pre-populate with the best default options but you can change them if desired.



You will see a message once the account has been successfully created:



Upon creating the account you will be presented with a screen containing a 'Primary' and 'Secondary' set of access keys for the Storage Account you just created. Store these keys as they will be needed to connect to Azure Storage later from SQL Server.



Don't worry if you quickly dismissed the dialog with the keys. You can always get back to them by selecting 'Manage Access Keys' at the bottom of the 'Storage' Azure option. You can also regenerate the keys if they have been compromised.




2. Export your SQL Database as a .bacpac file directly to Azure

Now that we have a storage account, we need to hop over to SQL Server Management Studio 2012 and export our database as a .bacpac file to Azure.

Right-click the database and select, 'Tasks' -> 'Export Data-tier Application...'




After selecting 'Next' from the Introduction screen, select the 'Save to Windows Azure' option and then press 'Connect'. Here you can enter the name of your Azure Storage Account created in step 1, as well as the 'Primary' key value provided when the Storage Account was created. Press the 'Connect' button once the information has been entered.



After the connect dialog has been dismissed add a 'Container' name that will contain the .bacpac file on Azure. Once the information is all correct, press the 'Next' button and being the export of data from your SQL Server database directly to Windows Azure! 



Once successfully exported, the bacpac file will be available for import back on the Azure Management Portal in storage.




3. Import your uploaded bacpac to a SQL Database on Azure

Finally, let's go back to the Windows Azure Management Portal and import the SQL Database bacpac file. Select 'SQL Databases' from the options on the left, and then from 'Data Services' -> 'SQL Database,' select the 'Import' option.



The next dialog will allow you to choose the database settings. To select the bacpac we already uploaded, press the folder icon to browse to the available data files in storage.



Expand your storage account and you should see the container name set when the .bacpac file was exported from SQL Server. Select the file and press 'Open' to automatically populate the bacpac URL.



Enter a name for the database, select your subscription, service tier, (do not select 'Web' or 'Business' from the screenshot as they will eventually be retired), performance, max size, and server. If you have previously created a SQL Server instance, you can choose it and provide the login information. If this is the 1st time, select  'New SQL database server' and press the next button. 



You will now need to create the SQL Server instance login information. Note that while sometimes Azure appears to be smart and pre-populate options (i.e. Region') with the one closest to you, I did not find this to be the case with this dialog. I believe 'East Asia' was pre-selected and provided me a warning that the storage account and database were not in the same region. Make sure to switch it to the same value as your storage account and the warning will be dismissed. Once you enter your login credentials, press the accept button to complete the process.



That's it! Your new SQL Database and instance once provisioned will display under 'SQL Databases' in Windows Azure for all of your cloud application and service needs.