This is the fourth post of how-to Windows Azure Connect series. Be sure to check out the other posts if you have not done so.
Go back to Visual Studio, on the Windows Azure Connect project, click on Publish. Leave the “Create Service Package Only” alone and click on OK.
Go to Windows Azure Developer Portal, click on Hosted Service, Storage Accounts & CDN. On the upper part, click on Hosted Services. Next Click New Hosted Service.
As the dialog bog show up, enter necessary info such service’s name, URL, region, and the package itself.
Waiting for a few moment will change your deployment’s status from Initializing, Busy, and finally Ready.
Try to click on the url that we’ve specify may most likely result you the error page that we’ve defined earlier since it will fail to connect to our on-premise machine.
Now,go to Virtual Network Menu,select the subscription and click on Create Group on the ribbon.
As the dialog box will show up, enter the group name, description (optional), select the “from” endpoint (which is our on-premise machine), and “to” endpoint (which is azure instance). Make sure that check the “Allow connection between endpoints in group” checkbox. Click Create when you are done.
Browse here and you can see the final result:
Now let’s move to the main part of this series which is the configuring the Windows Azure Connect.
At the time where this post was written, Windows Azure Connect is on beta status. Therefore, for those who have not possess the access, log-on to http://windows.azure.com, click on Beta Programs and click on appropriate service.
Having done so, you will probably need some time (may varies to days or weeks) in order to be activated).
Assuming your request has been granted, on the Windows Azure Developer Portal, click on Virtual Network link a the left-bottom of the page.
Select your appropriate subscription and click OK to activate your Windows Azure Connect when a pop-up occurs.
The next step is to get a token and apply the token to our Windows Azure Project. The intention of doing this is to tell Windows Azure Connect that this particular role is “Windows Azure Connect –enabled”.
To do that, click on Get Activation Token. When the pop-up occurs, copy the token by clicking on Copy to Clipboard.
If a Silverlight dialog show up, click on Yes to accept.
Go back to your Visual Studio’s solution, double-click on your intended role (in my cases WebRole1). Click on Virtual Network tab, check the Activate Windows Azure Connect checkbox and paste the token key that we’ve copied on the portal earlier.
Next step is to installing a small agent on our on-premise machine. Windows Azure Connect has the ability to connect back to on-premise machine through this small agent.
Go back to our Windows Azure Developer Portal. To get the agent, click on Install Local Endpoint button, copy the URL to the Clipboard.
Paste on your browser to download the agent. Please note that at the moment, we can only use IE to download.
When finished the download, install the agent by following the wizard.
You can click on Open Windows Azure Connect and see the detail.
As expected, the agent is not connected since it has not been configured.
Go back to your Windows Azure Developer Portal, you will now can see that your machine name (including the details of that machine) is shown on the Groups and Roles section.
In the next post, I’ll show you how to group the on-premise instance with cloud instances.
This is the second post of “how-to” establishing virtual network connection between cloud and on-premise with Windows Azure. Please check out the first post of preparing on-premise server and firewall, in my case SQL Server.
In this post, we’ll prepare the application that will be hosted on the cloud. Honestly, this would be a simple ASP.NET Web application without any fancy thing. You may skip this part if you find that you have similar sample app that can perform similar capabilities. Otherwise, you may want to follow my step below.
1. Create new Windows Azure Cloud project on your Visual Studio and select an ASP.NET Web Role into the project.
2. Open the Default.aspx file from your WebRole project and make some changes inside tag <asp:Content ID=”BodyContent” . . . /> as following:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Windows Azure Connect Demo </h2> <p> This is a <a href="http://www.microsoft.com/windowsazure/virtualnetwork/default.aspx">Windows Azure Connect</a> Demo which enables us to create virtual network connection between Windows Azure cloud instances to on-premise machine. <br />This app is hosted on Windows Azure whereby the data was retrieved from SQL Server of Wely''s computer. </p> <h3>Customer Data</h3> <p> <asp:GridView runat="server" ID="gv" AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" > <Columns> <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" /> <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT TOP 10 [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]"> </asp:SqlDataSource> </p> </asp:Content>
It’s pretty clear that the code above simple uses a gridview to display basic information of Customers’ table in Northwind database.
3. Please also make sure that your web.config file contain a NorthwindConnectionString definition, in example:
<connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=[YOUR-PC];Initial Catalog=Northwind;Persist Security Info=True;User ID=username;Password=[putyourpasswordhere]" providerName="System.Data.SqlClient" /> </connectionStrings>
I recommend you to use your computer name on the “data source”, not (localhost), ., or 127.0.0.1 since when your app is on cloud,it definitely will interpret differently.
4. If I run my application by pressing F5,it suppose to run well if everything is successfully configured. So far, nothing fancy, very basic stuff.
5 [OPTIONAL]. I strongly aware that my machine is not a server that alive 24 hours, yet the app on the cloud will connect back to my local machine specifically my database engine. You will see an error page when my machine is not connected due to reasons such as my machine is shutdown or the internet is not connected or whatever other reasons.
To prevent un-friendly standard error message, I am going to prepare an specific error page that explaining the reason why you are seeing the reason.
Do not forget to insert an custom error page setting on your web.config and set it to the intended page.
On the next post, I’ll show you more interesting stuff especially on Windows Azure Connect. See you.
This is the “how-to” post on establishing virtual network connection between cloud instances and on-premise server with Windows Azure Connect. Please check out my last post about how the idea and concept beyond Windows Azure Connect works.
The objective of this “how-to” post is to demonstrate how we host our web application on Windows Azure, yet we can connect to on-premise services, in this case SQL Server database. Please keep in mind that, the application is not a fancy application, however the main objective is to show how we use Windows Azure Connect.
1. The first step is to prepare necessary database and tables. In this case, I will be using Northwind sample database (Customer table) that you can download here.
2. Please also ensure that your database engine’s authentication accept SQL Server authentication. From SQL Server Management Studio, right click on your server and select “Properties” and go to “Security Tab”.
3. Next is to allow remote connection to the server. On the same dialog box, go to the Connections page and check the “Allow remote connections to this server” checkbox.
4. Subsequently is to ensure that TCP/IP protocol is enabled so that people would be able to connect our SQL Server database.
5. Having done configuring the SQL Server, next is to configure firewall to allow inbound call from the cloud instance. To do that, Open Windows Firewall with Advanced Security.
Select Inbound Rules and create a new rule. In the new inbound rule wizard, click on port for rule type. Apply it for TCP and specific port 1433.
Next, select allow connection and apply to all domain,private,and public location. You can then name the rule “SQL Inbound Rule”
On the subsequent post, I’ll prepare an application used to host it on the cloud.