layout: page title: “Azure Storage Service: Getting Started Guide” permalink: /guides/azure-storage/

  1. Sign up for an Azure Account
  2. Get your account and key
    • Login to the Windows Azure Portal
    • Click New Project, and then select Storage Account.
    • Enter a project label and click Next.
    • Enter the same name for the Storage Account Name. Make sure the account is available and then click Create
      • This is your account in jclouds.
    • Under the main azure screen, you should see Cloud Storage and the service you setup; Click on that.
      • Primary Access Key is the key you use in jclouds
  3. Ensure you are using a recent JDK 6
  4. Setup your project to include azureblob
    • Get the dependency org.jclouds.provider/azureblob using jclouds Installation.
  5. Start coding

{% highlight java %} import static org.jclouds.azure.storage.blob.options.CreateContainerOptions.Builder.withPublicAcl;

// get a context with amazon that offers the portable BlobStore api BlobStoreContext context = ContextBuilder.newBuilder(“azureblob”) .credentials(accesskeyid, secretkey) .buildView(BlobStoreContext.class);

//create a container in the default location context.getBlobStore().createContainerInLocation(null, bucket);

// use the map interface for easy access to put/get things, keySet, etc. context.createInputStreamMap(bucket).put(“blob.txt”, inputStream);

// when you need access to azureblob-specific features, use the provider-specific context AzureBlobClient client = AzureBlobClient.class.cast(context.getProviderSpecificContext().getApi());

// create a root-level container with a public acl client.createRootContainer(withPublicAc());

context.close(); {% endhighlight %}