Darqer
Darqer

Reputation: 2887

Azure: How to get StorageCredentials in standalone application

I would like to create standalone application which I would like to put on my Azure instance. This application should create vhd on the blob. I look through sample code and it seems to me that I need to use var drive = new CloudDrive(driveURI, credentials);

Is there a way to automatically retrieve StorageCredentials object under this standalone application.

I can add project of this application it to my Azure deploy solution if needed.

Upvotes: 2

Views: 585

Answers (2)

David Makogon
David Makogon

Reputation: 71028

You'd need to either:

  • Add the appropriate Windows Azure libraries to your standalone app so that it can mount a cloud drive)
  • Mount the cloud drive from your role's OnStart(), get a drive letter, then launch your standalone app, passing in the drive letter as a parameter (or maybe an environment variable).

It's probably better to mount the drive externally to your standalone app, so that your app is not dependent on Windows Azure.

Also note: Any mounted drive may only have one writer at any given time. So, if you scale to multiple instances, each instance would need its own vhd if they all needed write-access.

Upvotes: 1

AvkashChauhan
AvkashChauhan

Reputation: 20571

I am sure my this sample will help you achieve everything, please let me know if there is something didn't work: http://mountvhdazurevm.codeplex.com/

The above sample tries to mount an already exisited VHD. In your case you just need to modify the code to create the VHD first and then mount it. The sample code you can get here

Upvotes: 1

Related Questions