Azure.ResourceManager.Storage
1.0.0-beta.11
Prefix Reserved
See the version list below for details.
dotnet add package Azure.ResourceManager.Storage --version 1.0.0-beta.11
NuGet\Install-Package Azure.ResourceManager.Storage -Version 1.0.0-beta.11
<PackageReference Include="Azure.ResourceManager.Storage" Version="1.0.0-beta.11" />
paket add Azure.ResourceManager.Storage --version 1.0.0-beta.11
#r "nuget: Azure.ResourceManager.Storage, 1.0.0-beta.11"
// Install Azure.ResourceManager.Storage as a Cake Addin #addin nuget:?package=Azure.ResourceManager.Storage&version=1.0.0-beta.11&prerelease // Install Azure.ResourceManager.Storage as a Cake Tool #tool nuget:?package=Azure.ResourceManager.Storage&version=1.0.0-beta.11&prerelease
Azure Storage Management client library for .NET
This package follows the new Azure SDK guidelines which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.
Getting started
Install the package
Install the Azure Storage management library for .NET with NuGet:
dotnet add package Azure.ResourceManager.Storage --prerelease
Prerequisites
Set up a way to authenticate to Azure with Azure Identity.
Some options are:
- Through the Azure CLI Login.
- Via Visual Studio.
- Setting Environment Variables.
More information and different authentication approaches using Azure Identity can be found in this document.
Authenticate the Client
The default option to create an authenticated client is to use DefaultAzureCredential
. Since all management APIs go through the same endpoint, in order to interact with resources, only one top-level ArmClient
has to be created.
To authenticate to Azure and create an ArmClient
, do the following:
using Azure.Identity;
using Azure.ResourceManager;
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
Additional documentation for the Azure.Identity.DefaultAzureCredential
class can be found in this document.
Key concepts
Key concepts of the Azure .NET SDK can be found here
Examples
Create a storage account
Before creating a storage account, we need to have a resource group.
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
SubscriptionResource subscription = await armClient.GetDefaultSubscriptionAsync();
string rgName = "myRgName";
AzureLocation location = AzureLocation.WestUS2;
ArmOperation<ResourceGroupResource> operation = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(location));
ResourceGroupResource resourceGroup = operation.Value;
Then we can create a storage account inside this resource group.
//first we need to define the StorageAccountCreateParameters
StorageSku sku = new StorageSku(StorageSkuName.StandardGrs);
StorageKind kind = StorageKind.Storage;
string location = "westus2";
StorageAccountCreateOrUpdateContent parameters = new StorageAccountCreateOrUpdateContent(sku, kind, location);
//now we can create a storage account with defined account name and parameters
StorageAccountCollection accountCollection = resourceGroup.GetStorageAccounts();
string accountName = "myAccount";
ArmOperation<StorageAccountResource> accountCreateOperation = await accountCollection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, parameters);
StorageAccountResource storageAccount = accountCreateOperation.Value;
Get all storage accounts in a resource group
StorageAccountCollection accountCollection = resourceGroup.GetStorageAccounts();
AsyncPageable<StorageAccountResource> response = accountCollection.GetAllAsync();
await foreach (StorageAccountResource storageAccount in response)
{
Console.WriteLine(storageAccount.Id.Name);
}
Get a storage account
StorageAccountCollection accountCollection = resourceGroup.GetStorageAccounts();
StorageAccountResource storageAccount = await accountCollection.GetAsync("myAccount");
Console.WriteLine(storageAccount.Id.Name);
Delete a storage account
StorageAccountCollection accountCollection = resourceGroup.GetStorageAccounts();
StorageAccountResource storageAccount = await accountCollection.GetAsync("myAccount");
await storageAccount.DeleteAsync(WaitUntil.Completed);
Add a tag to the storage account
StorageAccountCollection accountCollection = resourceGroup.GetStorageAccounts();
StorageAccountResource storageAccount = await accountCollection.GetAsync("myAccount");
// add a tag on this storage account
await storageAccount.AddTagAsync("key", "value");
For more detailed examples, take a look at samples we have available.
Troubleshooting
- If you find a bug or have a suggestion, file an issue via GitHub issues and make sure you add the "Preview" label to the issue.
- If you need help, check previous questions or ask new ones on StackOverflow using azure and .NET tags.
- If having trouble with authentication, go to DefaultAzureCredential documentation
Next steps
More sample code
Additional Documentation
For more information on Azure SDK, please refer to this website.
Contributing
For details on contributing to this repository, see the contributing guide.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Azure.Core (>= 1.25.0)
- Azure.ResourceManager (>= 1.2.0)
- System.Text.Json (>= 4.7.2)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Azure.ResourceManager.Storage:
Package | Downloads |
---|---|
IglooSoftware.Sdk.EventSourcing
Igloo Event Sourcing SDK for services. |
|
Neon.Kube.Azure
INTERNAL USE ONLY: neonKUBE hosting manager for Azure |
|
ModularPipelines.Azure
Helpers for interacting with Azure. |
|
Ngs.Agent.AzureResources
Package Description |
|
Ngs.Server.Utilities
Package Description |
GitHub repositories (7)
Showing the top 5 popular GitHub repositories that depend on Azure.ResourceManager.Storage:
Repository | Stars |
---|---|
Azure/azure-sdk-for-net
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
microsoft/onefuzz
A self-hosted Fuzzing-As-A-Service platform
|
|
Azure/Industrial-IoT
Azure Industrial IoT Platform
|
|
thomhurst/ModularPipelines
Write your pipelines in C# !
|
Version | Downloads | Last updated |
---|---|---|
1.3.0 | 409,716 | 6/28/2024 |
1.2.3 | 265,534 | 5/7/2024 |
1.2.2 | 16,885 | 4/29/2024 |
1.2.1 | 128,505 | 3/25/2024 |
1.2.0 | 541,656 | 11/24/2023 |
1.2.0-beta.2 | 5,456 | 8/14/2023 |
1.2.0-beta.1 | 2,282 | 6/1/2023 |
1.1.1 | 1,114,834 | 2/14/2023 |
1.1.0 | 322,717 | 12/6/2022 |
1.0.0 | 373,198 | 9/8/2022 |
1.0.0-beta.12 | 9,084 | 8/18/2022 |
1.0.0-beta.11 | 47,729 | 7/21/2022 |
1.0.0-beta.10 | 2,204 | 6/24/2022 |
1.0.0-beta.9 | 37,956 | 5/13/2022 |
1.0.0-beta.8 | 13,463 | 4/8/2022 |
1.0.0-beta.7 | 753 | 3/31/2022 |
1.0.0-beta.6 | 33,075 | 1/30/2022 |
1.0.0-beta.5 | 29,418 | 12/28/2021 |
1.0.0-beta.4 | 6,440 | 12/2/2021 |
1.0.0-beta.3 | 3,160 | 10/28/2021 |
1.0.0-beta.2 | 2,724 | 9/14/2021 |
1.0.0-beta.1 | 302 | 9/1/2021 |