public static PSStorageAccount Create(StorageModels.StorageAccount storageAccount, IStorageManagementClient client)
 {
     var result = new PSStorageAccount(storageAccount);
     var credentials = StorageUtilities.GenerateStorageCredentials(client, result.ResourceGroupName, result.StorageAccountName);
     CloudStorageAccount account = new CloudStorageAccount(credentials,
         storageAccount.PrimaryEndpoints.Blob, storageAccount.PrimaryEndpoints.Queue, storageAccount.PrimaryEndpoints.Table, null);
     result.Context = new AzureStorageContext(account);
     return result;
 }
Esempio n. 2
0
        public static PSStorageAccount Create(StorageModels.StorageAccount storageAccount, IStorageManagementClient client)
        {
            var result = new PSStorageAccount(storageAccount);
             result.Context = new LazyAzureStorageContext((s) => 
             { 
                var credentials = StorageUtilities.GenerateStorageCredentials(new ARMStorageProvider(client), result.ResourceGroupName, s); 
                 return new CloudStorageAccount(credentials, 
                     ARMStorageService.GetUri(storageAccount.PrimaryEndpoints.Blob), 
                     ARMStorageService.GetUri(storageAccount.PrimaryEndpoints.Queue), 
                     ARMStorageService.GetUri(storageAccount.PrimaryEndpoints.Table), 
                     ARMStorageService.GetUri(storageAccount.PrimaryEndpoints.File)); 
             }, result.StorageAccountName) as AzureStorageContext; 

            return result;
        }
 public PSStorageAccount(StorageModels.StorageAccount storageAccount)
 {
     this.ResourceGroupName = ParseResourceGroupFromId(storageAccount.Id);
     this.StorageAccountName = storageAccount.Name;
     this.Id = storageAccount.Id;
     this.Location = storageAccount.Location;
     this.AccountType = storageAccount.AccountType;
     this.CreationTime = storageAccount.CreationTime;
     this.CustomDomain = storageAccount.CustomDomain;
     this.LastGeoFailoverTime = storageAccount.LastGeoFailoverTime;
     this.PrimaryEndpoints = storageAccount.PrimaryEndpoints;
     this.PrimaryLocation = storageAccount.PrimaryLocation;
     this.ProvisioningState = storageAccount.ProvisioningState;
     this.SecondaryEndpoints = storageAccount.SecondaryEndpoints;
     this.SecondaryLocation = storageAccount.SecondaryLocation;
     this.StatusOfPrimary = storageAccount.StatusOfPrimary;
     this.StatusOfSecondary = storageAccount.StatusOfSecondary;
     this.Tags = storageAccount.Tags;
 }
 protected void WriteStorageAccount(StorageModels.StorageAccount storageAccount)
 {
     WriteObject(PSStorageAccount.Create(storageAccount, this.StorageClient));
 }