如何从外部网站连接到Azure的数据存储?

I'm new to the whole idea of cloud programming to store information connected to mobile/web/applications. I've been reading through tutorials and Microsoft seems to have done a good job tying everything together and making it fairly simple to adapt for your purposes.

However, all tutorials assume you will be using every aspect of your application from Microsoft's Azure (website, mobile services, data storage, database etc.).

I'm wondering if anybody knows of an example I can use to see how to connect an external website (one not hosted on Microsoft Azure) to their Data Storage (on Azure)? What do the connection strings look like? Most importantly, how do you add the libraries/classes to the external server?

i.e.

  • user makes changes to record/entity on www.example.com (php)
  • www.example.com connects to data storage on Windows Azure
  • record/entity is update/inserted

It seems like there should be a fairly easy solution to this, or maybe I'm missing something?

Thanks for any help!

Microsoft's cloud offering (Azure) consists of different components which can be used to store data.

SQL Azure databases behave just like every other MS SQL Server database. Their scalability and flexibility is completely abstracted and you should be fine using any PHP+MSSQL sample or the normal documentation. In terms of connection strings: They also work as expected and for most scenarios you do not have to do anything different. This minimal sample shows how to use SQL Azure from PHP. You can just ignore the first part setting up the Azure application. You should be able use the same php code snippet from any other hosting scenario (e.g. Apache+PHP on Linux). If you have issues connecting you might want to have a look at the allowed ip addresses configuration of your server in the Azure management portal and allow the IP of your external server/hoster.

Azure storage (Blobs, Queues, Tables) are basically simpler means of storing data. You can use it through the azure sdk for php and have a look at the samples. Most of this article should apply to your scenario as well. Storage is cheaper for many scenarios compared to using a SQL database.

So to sum up: You don't have to to anything "special" for your scenario. Just use SQL Azure like any other database. Simply store files in Azure blobs.

As for any application spanning multiple data-centers: Be aware of latency. Round-trips to the database/storage will be more expensive (in terms of performance) than when hosting everything at one site. This can be a significant performance bottleneck depending on your application.