Azure

Street To AZ 204 – Creating Options That Use Blob Storage

Getting Container Properties:

  1. az storage container present –name $containerName –account-name $storageAccountName –account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==  

 

Setting and Getting Container Metadata, the eye that the replace command overwrites the present container metadata 

  1. az storage container metadata replace –account-name $storageAccountName –name $containerName –metadata creationType=AzureCli –auth-mode key –account-key “P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==”  
  2. az storage container metadata present –account-name $storageAccountName –name $containerName –auth-mode key –account-key “P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==”  

Setting and Getting Blob Metadata, consideration that the replace command overwrites the present blob metadata

  1. az storage blob metadata replace –name “frequent.jpg” –account-name $storageAccountName –container-name $containerName –metadata creationType=azurecli –auth-mode key –account-key “P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==”  
  2. az storage blob metadata present –name “frequent.jpg” –account-name $storageAccountName –container-name $containerName –auth-mode key –account-key “P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==”   

 

Utilizing .NET

 

Getting Container Properties

  1. personal static readonly string connectionString = “DefaultEndpointsProtocol=https;AccountName=samplestorageaccountblob;AccountKey=NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==;EndpointSuffix=core.home windows.internet”;  
  2.       personal static readonly string containerName = “sampleblobcontainer”;  
  3.       static async Activity Primary(string[] args)  
  4.       {  
  5.   
  6.           Console.WriteLine(“Program began. Connecting to Blob Shopper”);  
  7.           BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);  
  8.           BlobContainerClient containerClient = null;  
  9.   
  10.           if (blobServiceClient.GetBlobContainers().The place(x => x.Identify == containerName).Any())  
  11.           {  
  12.               Console.WriteLine(“Blob Container Shopper discovered.”);  
  13.               containerClient = blobServiceClient.GetBlobContainerClient(containerName);  
  14.           }  
  15.           else  
  16.           {  
  17.               Console.WriteLine(“Blob Container Shopper not discovered, creating a new one.”);  
  18.               containerClient = await blobServiceClient.CreateBlobContainerAsync(containerName);  
  19.               Console.WriteLine(“Blob Container Shopper created.”);  
  20.           }  
  21.           var properties = containerClient.GetProperties();  
  22.       }  

Setting and Getting Container Metadata, concentrate that the SetMetada technique overwrites the present metadata.

  1. personal static readonly string connectionString = “DefaultEndpointsProtocol=https;AccountName=samplestorageaccountblob;AccountKey=P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==;EndpointSuffix=core.home windows.internet”;  
  2.         personal static readonly string containerName = “sampleblobcontainer”;  
  3.          
  4.         static async Activity Primary(string[] args)  
  5.         {  
  6.   
  7.             Console.WriteLine(“Program began. Connecting to Blob Shopper”);  
  8.             BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);  
  9.             BlobContainerClient containerClient = null;  
  10.   
  11.             if (blobServiceClient.GetBlobContainers().The place(x => x.Identify == containerName).Any())  
  12.             {  
  13.                 Console.WriteLine(“Blob Container Shopper discovered.”);  
  14.                 containerClient = blobServiceClient.GetBlobContainerClient(containerName);  
  15.             }  
  16.             else  
  17.             {  
  18.                 Console.WriteLine(“Blob Container Shopper not discovered, creating a new one.”);  
  19.                 containerClient = await blobServiceClient.CreateBlobContainerAsync(containerName);  
  20.                 Console.WriteLine(“Blob Container Shopper created.”);  
  21.             }  
  22.             Dictionary<stringstring> containerMetadata = new Dictionary<stringstring>();  
  23.             containerMetadata.Add(“creationType”“.Web SDK”);  
  24.             containerMetadata.Add(“seccondMetadata”“.Web SDK”);  
  25.             containerClient.SetMetadata(containerMetadata);  
  26.             var containerProperties = containerClient.GetProperties();  
  27.         }  

Setting and Getting Blob Metadata, concentrate that the SetMetada technique overwrites the present metadata.

  1. personal static readonly string connectionString = “DefaultEndpointsProtocol=https;AccountName=samplestorageaccountblob;AccountKey=P3o/5qMhTrI8rJgt34SPSaeLuv7ED6Szft5kAf7hixh2UiSwltBW52CG4FejDs3nhV4t2lAE/2XEAIAsUvKorA==;EndpointSuffix=core.home windows.internet”;  
  2.         personal static readonly string containerName = “sampleblobcontainer”;  
  3.         static async Activity Primary(string[] args)  
  4.         {  
  5.   
  6.             Console.WriteLine(“Program began. Connecting to Blob Shopper”);  
  7.             BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);  
  8.             BlobContainerClient containerClient = null;  
  9.   
  10.             if (blobServiceClient.GetBlobContainers().The place(x => x.Identify == containerName).Any())  
  11.             {  
  12.                 Console.WriteLine(“Blob Container Shopper discovered.”);  
  13.                 containerClient = blobServiceClient.GetBlobContainerClient(containerName);  
  14.             }  
  15.             else  
  16.             {  
  17.                 Console.WriteLine(“Blob Container Shopper not discovered, creating a new one.”);  
  18.                 containerClient = await blobServiceClient.CreateBlobContainerAsync(containerName);  
  19.                 Console.WriteLine(“Blob Container Shopper created.”);  
  20.             }  
  21.   
  22.   
  23.             Dictionary<stringstring> blobMetadata = new Dictionary<stringstring>();  
  24.             blobMetadata.Add(“creationType”“.Web SDK”);  
  25.             blobMetadata.Add(“seccondMetadata”“.Web SDK”);  
  26.             BlobClient consumer = containerClient.GetBlobClient(“frequent.jpg”);  
  27.             consumer.SetMetadata(blobMetadata);  
  28.             var blobMetadataValues = consumer.GetProperties().Worth.Metadata;  
  29.         }  

 

End result from Azure Portal 

 

 

Transferring gadgets between Blob Storage and Containers

 

You’ll be able to copy a single Blob or a Batch of Blobs, right here we can be shifting a batch of Blobs from one container to a different inside the identical Blob Storage Account. 

 

The error right here is because of the Uncommon.jpg being rehydrated. 

 

  1. az storage blob copy start-batch –account-name $storageAccountName –destination-container “anothercontainer” –source-container $containerName –account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==   

Transferring from one container to a different inside one other storage account.

  1. az storage blob copy start-batch –account-name “cloudshell325844558” –source-account-name $storageAccountName –source-container “anothercontainer” –destination-container “containeranotheraccount” –account-key Oc3mEd/80DqJ65+nxMUJb/C9nq/hre+YLdVEfXeZ7M3gvcwJ7zqB7SAzNaiRtPyOrEtYXBub9Wn4xVUgTv5BTw== –source-account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==   
 

Sizzling, Cool, and Archiving Storage

 

By default, if you create a Blob its entry tier is ready routinely to the one configured when creating Azure Storage. And by default, Blob Storages are created with the Sizzling Entry Tier, with a purpose to change the default entry tier of the Storage Account, examine the configuration tab beneath the settings sector.

 

 

To alter the entry tier of a blob you must individually set its new entry tier. We’re going to arrange the blobs in keeping with their requirements: frequent picture stays within the sizzling tier, not so frequent picture stays within the cool tier and the uncommon picture goes to be positioned within the archiving tier.

 

 
  1. az storage blob set-tier –account-name $storageAccountName –container-name $containerName –name “not so frequent.png” –tier Cool –account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==  
  2. az storage blob set-tier –account-name $storageAccountName –container-name $containerName –name “uncommon.jpg” –tier Archive –account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==   

Lead to Azure Portal

 

 

To maneuver one merchandise from Archive Entry Tier to a different Entry Tier you can even set the rehydrate precedence to excessive. This characteristic continues to be in preview mode.

 

  1. az storage blob set-tier –account-name $storageAccountName –container-name $containerName –name “uncommon.jpg”  –tier Cool –rehydrate-priority excessive   –account-key NSs2H9xg8DIpKH8y3EeYMiIpM1zYl/K9oAlBvDnPJaOpwUuS1GIwnbllIBuWngVpUYkpzmiRHdJiybgmGR3tag==  

 

Implementing Archiving and Retention – Lifecycle Administration

 

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button