Example #1
0
 public BlobManager(string ContainerName)
 {
     if (string.IsNullOrEmpty(ContainerName))
     {
         throw new ArgumentNullException(Constants.Container, Constants.ContainerNameError);
     }
     try
     {
         Keymanager          keyVaultManager  = new Keymanager();
         string              ConnectionString = keyVaultManager.GetValueFromAzureVault(Constants.SecretName);
         CloudStorageAccount storageAccount   = CloudStorageAccount.Parse(ConnectionString);
         CloudBlobClient     cloudBlobClient  = storageAccount.CreateCloudBlobClient();
         blobContainer = cloudBlobClient.GetContainerReference(ContainerName);
         if (blobContainer.CreateIfNotExists())
         {
             blobContainer.SetPermissions(
                 new BlobContainerPermissions
             {
                 PublicAccess = BlobContainerPublicAccessType.Blob
             }
                 );
         }
     }
     catch (Exception ExceptionObj)
     {
         throw ExceptionObj;
     }
 }
Example #2
0
        public CloudTable CreateTable(string tableName)
        {
            Keymanager          keyVaultManager  = new Keymanager();
            string              ConnectionString = keyVaultManager.GetValueFromAzureVault(Constants.SecretName);
            CloudStorageAccount storageAccount   = CreateStorageAccountFromConnectionString(ConnectionString);
            CloudTableClient    tableClient      = storageAccount.CreateCloudTableClient(new TableClientConfiguration());

            tableClient.TableClientConfiguration.UseRestExecutorForCosmosEndpoint = true;
            CloudTable table = tableClient.GetTableReference(tableName);

            table.CreateIfNotExists();
            return(table);
        }