I couldn't find anything about how to get all storage accounts, I know it is possible get all blob containers and queues, so Is it possible to get all storage accounts by Azure-Functions?
Or is it possible to generate a unique SAS Token for access all storage Accounts, so I can use on StorageCredentials(string sasToken) ?
You could use Microsoft.Azure.Management.Fluent to list all the storage account in your subscription.
Refer to the following code:
var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"D:\azurecred.txt");
var azure = Azure
.Configure()
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.Authenticate(credentials)
.WithDefaultSubscription();
var account = azure.StorageAccounts.List();
You need to set subscription,client,key,tenantId in your credentials file.
It is possible to get all storage accounts using the StorageManagementClient (you have to install the Microsoft.WindowsAzure.Management.Storage NuGet package).
After you set your authentication and subscription you can call the List() method on the StorageAccounts property. e. g. :
new StorageManagementClient().StorageAccounts.List()
The List Storage Accounts operation lists the storage accounts that are available in the specified subscription.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With