This blogpost is part of a series on “Writing an Azure application and integrating it with SharePoint Securely”.
Table of Contents -
- Writing a simple MVC app
- Porting our MVC app to Azure – adding table storage.
- Adding a worker role
- Deploying the application to Azure <—You are here!
- Integrating this Azure application with SharePoint
Now that you have written a fully functional app, it is time to take this to Azure! The real azure. If you have not yet finished the rest of the labs, you can start this lab with the project in ComplaintBox – AzureWebWorker.zip
Our application needs an application and a storage account. There are many ways to deploy our application to Azure
- Through powershell
- Through visual studio
Let’s use the manual option for this exercise.
Navigate to windows.azure.com and login with your credentials. Click on “Hosted Services, Storage Accounts & CDN”, and go to “Hosted Services” and create a new hosted service as shown below
Also provision a storage account,
Now patiently wait for these accounts to get created :).
Once they are created, go to the storage account, and click on it to view your “Primary access key”. It will be a long odd looking string. Now create a connection string as shown below,
DefaultEndpointsProtocol=https;AccountName=winsmarts;AccountKey=<that long crazy string goes here>
Now, go into the properties of the roles (ComplaintBox and Process Complaint), and set the connection string as shown below for the “Cloud” Configuration.
Now, open the ServiceConfiguration.Cloud.cscfg file, and note that the file has been edited for you!
The rest is quite easy now! Go ahead and right click on the ComplaintBox.Azure project, and choose “Package” with the following settings,
Note that when you click on “Enable Report Desktop for all roles”, a dialog box will pop open and ask you for credentials. In order to enable RDP, you will also need to export the certificate and upload it into Azure. In the dialogbox, click on the “View” button to view the certificate, and click on the “Copy to File” on the “Details” tab. You have to ensure that you export it with a private key, and also provide a password.
In Azure, now, select the certificates portion in your application and click on “Add certificate” and upload the certificate.
Click on the package button, and it will produce two files as shown below,
Now, navigate to the azure portal, and choose to create a new staging deployment as shown below
Find the .cspkg and cscfg files in the ensuing dialogbox, and upload them into Azure. You will also see a warning like this, you can ignore this.
Now, wait for the applications to get created. Your azure portal will look like as shown below in a moment, wait patiently :), take a break, and go get some coffee, maybe even some donuts! Come back in about 5 minutes.
Once the applications are ready, as shown below,
Click on the DNS name, you will see that the application is running exactly as it was on your local development machine, except now it’s running in Azure!
Now here is the really cool thing! Select the ProcessComplaint_IN_0 or ComplaintBox_IN_0, and you will see that the connect button is enabled in the toolbar.
Click on the connect button, you will see that you are able to RDP into the actual VM that is running your role (web or worker!). This is incredibly useful when it comes to debugging your worker/web roles in the cloud. You can also use profiling and intellitrace.