-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
21 lines (20 loc) · 909 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Azure.Identity;
using Azure.Storage.Blobs;
using System;
class Program
{
static async Task Main(string[] args)
{
try {
var storageAccountName = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT_NAME");
var storageAccountContainerName = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT_CONTAINER_NAME");
var blobServiceClient = new BlobServiceClient(new Uri($"https://{storageAccountName}.blob.core.windows.net/"), new DefaultAzureCredential());
var containerClient = blobServiceClient.GetBlobContainerClient($"{storageAccountContainerName}");
await containerClient.CreateIfNotExistsAsync();
Console.WriteLine($"Container/Folder {storageAccountContainerName} was successfully created.");
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
}
}
}