Neo
Neo

Reputation: 16239

Unable to create container on Azure Storage

I'm trying to create azure storage using follwing simple code.

Tried manually for cross check working fine manually.

static void Main(string[] args)
{
    //Parse the connection string and return a reference to the storage account.
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

    //Create the blob client object.
    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

    //Get a reference to a container to use for the sample code, and create it if it does not exist.
    CloudBlobContainer container = blobClient.GetContainerReference("sascontainer");
    container.CreateIfNotExists();
}

getting error :

An unhandled exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll Additional information: The remote server returned an error: (407) Proxy Authentication Required.

App.config

  <appSettings>
    <add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=ashuthinks;AccountKey=MYKEY"/>
  </appSettings>

Upvotes: 2

Views: 2051

Answers (1)

DSR
DSR

Reputation: 4668

Add <defaultProxy useDefaultCredentials="true" /> in to your configuration file explained below.

<configuration> 
 <system.net> 
   <defaultProxy enabled="true" useDefaultCredentials="true"> 
    <proxy usesystemdefault="true" /> 
   </defaultProxy>
  </system.net>
<configuration>

Upvotes: 4

Related Questions