The second letter in the Hebrew alphabet is the ב bet/beit. Its meaning is "house". In the ancient pictographic Hebrew it was a symbol resembling a tent on a landscape.
Note: Pre-release packages are distributed via feedz.io.
The purpose of this repo is create an extension to Azure Storage Libraries and support MSI identity or token authentication.
This library contains collection of Azure Storage functionality.
- It provides with a configurable model that centralizes creation of the instances of
CloudStorageAccount
per configuration. - It allows configuration of AspNetCore Static File options to use Azure Storage Blob Container.
Sample App requires Azure storage emulator for development
If you like or are using this project to learn or start your solution, please give it a star. Thanks!
dotnet add package Bet.Extensions.AzureStorage
Azure Storage Account can be created with the following configurations settings:
- MSI authentication simply specify Azure Storage Name of the account.
"AzureStorage": {
"DefaultAccount": {
"Name": "storageName"
}
}
- SAS Token Authentication
"AzureStorage": {
"DefaultAccount": {
"Name": "storageName",
"Token": "tokenValue",
"ConnectionString": ""
}
}
- ConnectionString
"AzureStorage": {
"DefaultAccount": {
"ConnectionString": "full-connection-string"
}
}
By default the following roles are not assigned:
- Storage Blob Data Contributor
- Storage Queue Data Contributor
- Make sure that default configuration exists for
CloudStorageAccount
. In the below configuration MSI authentication will be used to connect to the container. As you can see no need to provide secure SAS token.
"AzureStorage": {
"DefaultAccount": {
"Name": "teststorage"
}
}
- Create
UploadsStorageBlobsOptions
class
public class UploadsProviderOptions : StorageFileProviderOptions
{
}
- Configure the Azure Blob Container
"StorageFileProviders": {
"UploadsProviderOptions": {
"RequestPath": "/uploads",
"ContainerName": "uploads",
"EnableDirectoryBrowsing": true
}
}
- Add Service registration
services.AddAzureStorageAccount()
.AddAzureBlobContainer<UploadsBlobOptions>()
.AddAzureStorageForStaticFiles<UploadsBlobStaticFilesOptions>();
- Enable middleware
app.UseAzureStorageForStaticFiles<UploadsProviderOptions>();