2

From this MSDN article it says that the connection string for connecting to the storage account must be HTTP and not HTTPS.

When I use this constructor:

public CloudDrive (
    Uri uri,
    StorageCredentials credentials
)

Does that mean the Uri to the page blob must also be HTTP and not HTTPS? I am a bit confused regarding which parameter (or both together) fits the 'connection string' description.

This scenario does not seem to be easily testable in dev emulator.

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
jws_
  • 307
  • 2
  • 9

1 Answers1

1

The URI (think of as the server-portion of the connection string) to the page blob represents the namespace + container + blob of your storage account. The credentials represent the user/pass which together with the URI comprise the connection string to the Azure cloud storage service.

The URI will always be HTTP assuming you are using the local emulator.

CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount;

When deploying to Azure, the URI scheme will be whatever you assign it in the service configuration (ServiceDefinition.csdef / ServiceConfiguration.Cloud.cscfg).

CloudStorageAccount storageAccount = CloudStorageAccount.FromConfigurationSetting("CloudDrive.DataConnectionString");

You would just want to assign CloudDrive.DataConnectionString to have DefaultEndpointsProtocol=http (the default if omitted, but you could be explicit).

ServiceDefinition.csdef

<ServiceDefinition>
  <WebRole>
    <!-- .... -->
    <ConfigurationSettings>
      <Setting name="CloudDrive.DataConnectionString" />
    </ConfigurationSettings>
  </WebRole>
</ServiceDefinition>

ServiceConfiguration.Cloud.cscfg

<ServiceConfiguration>
  <Role>
    <ConfigurationSettings>
     <Setting name="CloudDrive.DataConnectionString" value="DefaultEndpointsProtocol=http;AccountName=YOURNAMESPACE;AccountKey=YOURKEY" />
    </ConfigurationSettings>
  </Role>
</ServiceConfiguration>
SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
  • [This MSDN blog post states HTTPS is not supported for `CloudDrive`](http://blogs.msdn.com/b/tconte/archive/2010/04/07/using-windows-azure-drive-part-2-modifying-my-application-to-use-the-drive.aspx?wa=wsignin1.0)...I will have to try and get back to you. – SliverNinja - MSFT Sep 20 '12 at 22:50
  • All my connection strings must be Https, so it seems the right way to use that constructor would be to ensure the uri portion is http: `CloudStorageAccount httpsAccount = ...;` `var blobUri = httpsAccount.GetContainerReference("mycontainer").GetPageBlobReference("myblob").Uri;` `var httpBlobUri = new UriBuilder(blobUri){Scheme ="http", Port = 80}.Uri;` `CloudDrive cloudDrive = new CloudDrive(httpBlobUri, httpsAccount.Credentials);` – jws_ Sep 20 '12 at 22:50
  • Why do you need the connection strings all defined as HTTPS? You can have multiple connection strings defined - just use a non-HTTPS one for `CloudDrive` interaction. When HTTPS is supported - you don't need to build/republish, you can just change the running configuration. – SliverNinja - MSFT Sep 20 '12 at 22:53
  • 1
    unfortunatly that part is out of my control, i'm just working under the assumption of receiving a https connection string. i will try my earlier comment of rebuilding the uri to be http instead of https. – jws_ Sep 20 '12 at 23:24