I am connecting to SQLAzure from my Azure service.
Most of the time, things work fine.
However, once in a while (about once a day), I am unable to connect. It lasts about 5 minutes.
I get the following error:
SQLException: A network-related or instance-specific error occurred
while establishing a connection to SQL Server
Is this to be expected?
Is it part of cloud programming?
Am I supposed to program defensively against it?
Yes, this is expected. It is expected in your connections and commands you build some kind of retry logic. How hard this is depends on your data layer.
There is lots of info on google
https://www.google.com/search?q=sql+azure+transient
Entity Framework - SQL Azure Retry Policy
This type of behavior is expected for SQL Azure and as well as for other cloud services. Microsoft provides the Transient Fault Application Block which includes robust transient fault handling logic for various Azure services, including SQL Azure.