Azure.ResourceManager.LoadTesting 1.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Azure.ResourceManager.LoadTesting --version 1.0.0
NuGet\Install-Package Azure.ResourceManager.LoadTesting -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azure.ResourceManager.LoadTesting" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.ResourceManager.LoadTesting --version 1.0.0
#r "nuget: Azure.ResourceManager.LoadTesting, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.ResourceManager.LoadTesting as a Cake Addin
#addin nuget:?package=Azure.ResourceManager.LoadTesting&version=1.0.0

// Install Azure.ResourceManager.LoadTesting as a Cake Tool
#tool nuget:?package=Azure.ResourceManager.LoadTesting&version=1.0.0

Microsoft Azure Load Testing management client library for .NET

Microsoft Azure Load Testing is a fully managed load-testing service that enables you to generate high-scale load. The service simulates traffic for your applications, regardless of where they're hosted. Developers, testers, and quality assurance (QA) engineers can use it to optimize application performance, scalability, or capacity.

This library supports managing Microsoft Azure Load Testing resources.

This library follows the new Azure SDK guidelines, and provides many core capabilities:

- Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET.
- Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing.
- HTTP pipeline with custom policies.
- Better error-handling.
- Support uniform telemetry across all languages.

Getting started

Install the package

Install the Microsoft Azure Load Testing management library for .NET with NuGet:

dotnet add package Azure.ResourceManager.LoadTesting

Prerequisites

Authenticate the Client

To create an authenticated client and start interacting with Microsoft Azure resources, see the quickstart guide here.

Key concepts

Key concepts of the Microsoft Azure SDK for .NET can be found here..

Documentation

Documentation is available to help you learn how to use this package:

Examples

Create a new Azure Load Testing resource

Before creating an Azure Load Testing resource, we need to have a resource group.

ArmClient armClient = new ArmClient(new DefaultAzureCredential());
SubscriptionResource subscription = await armClient.GetDefaultSubscriptionAsync();
ResourceGroupCollection rgCollection = subscription.GetResourceGroups();
// With the collection, we can create a new resource group with an specific name
string rgName = "sample-rg";
AzureLocation location = AzureLocation.WestUS2;
ArmOperation<ResourceGroupResource> resourceGroupLro = await rgCollection.CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(location));
ResourceGroupResource resourceGroup = lro.Value;

Create an Azure Load Testing resource.

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();
string loadTestResourceName = "sample-loadtest";
LoadTestingResourceData inputPayload = new LoadTestingResourceData(AzureLocation.WestUS2);
ArmOperation<LoadTestingResource> loadTestingLro = await loadTestingCollection.CreateOrUpdateAsync(WaitUntil.Completed, loadTestResourceName, inputPayload);

LoadTestingResource resource = loadTestingLro.Value;

Create an Azure Load Testing resource configured with CMK encryption.

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();
string loadTestResourceName = "sample-loadtest";
LoadTestingResourceData inputPayload = new LoadTestingResourceData(AzureLocation.WestUS2);

// Managed identity properties
ResourceIdentifier identityId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1");
inputPayload.Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssignedUserAssigned);
inputPayload.Identity.UserAssignedIdentities.Add(identityId, new UserAssignedIdentity());

// CMK encryption properties
inputPayload.Encryption = new LoadTestingCmkEncryptionProperties();
inputPayload.Encryption.KeyUri = new Uri("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde");
inputPayload.Encryption.Identity = new LoadTestingCmkIdentity();
inputPayload.Encryption.Identity.IdentityType = LoadTestingCmkIdentityType.UserAssigned;
inputPayload.Encryption.Identity.ResourceId = identityId;

ArmOperation<LoadTestingResource> loadTestingLro = await loadTestingCollection.CreateOrUpdateAsync(WaitUntil.Completed, loadTestResourceName, inputPayload);

LoadTestingResource resource = loadTestingLro.Value;

Get details of an Azure Load Testing resource

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();

string loadTestResourceName = "sample-loadtest";
Response<LoadTestingResource> loadTestingResponse = await loadTestingCollection.GetAsync(loadTestResourceName);

LoadTestingResource resource = loadTestingResponse.Value;

Update an Azure Load Testing resource

Update an Azure Load Testing resource to configure CMK encryption using system-assigned managed identity.

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();
string loadTestResourceName = "sample-loadtest";
Response<LoadTestingResource> loadTestingResponse = await loadTestingCollection.GetAsync(loadTestResourceName);
LoadTestingResource resource = loadTestingResponse.Value;

ResourceIdentifier identityId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1");
LoadTestingResourcePatch resourcePatchPayload = new LoadTestingResourcePatch {
    Encryption = new LoadTestingCmkEncryptionProperties
    {
        Identity = new LoadTestingCmkIdentity
        {
            // make sure that system-assigned managed identity is enabled on this resource and the identity has been granted required permissions to access the key.
            IdentityType = LoadTestingCmkIdentityType.SystemAssigned,
            ResourceId = null
        },
        KeyUri = new Uri("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde")
    }
};

ArmOperation<LoadTestingResource> loadTestingLro = await resource.UpdateAsync(WaitUntil.Completed, resourcePatchPayload);

LoadTestingResource updatedResource = loadTestingLro.Value;

Update an Azure Load Testing resource to update user-assigned managed identities.

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();
string loadTestResourceName = "sample-loadtest";
Response<LoadTestingResource> loadTestingResponse = await loadTestingCollection.GetAsync(loadTestResourceName);
LoadTestingResource resource = loadTestingResponse.Value;

ResourceIdentifier identityId1 = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1");
ResourceIdentifier identityId2 = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity2");

LoadTestingResourcePatch resourcePatchPayload = new LoadTestingResourcePatch();
resourcePatchPayload.Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.UserAssigned);
// removes user-assigned identity with resourceId <identityId1> (if already assigned to the load testing resource)
resourcePatchPayload.Identity.UserAssignedIdentities.Add(identityId1, null);
resourcePatchPayload.Identity.UserAssignedIdentities.Add(identityId2, new UserAssignedIdentity());

ArmOperation<LoadTestingResource> loadTestingLro = await resource.UpdateAsync(WaitUntil.Completed, resourcePatchPayload);
LoadTestingResource updatedResource = loadTestingLro.Value;

Delete an Azure Load Testing resource

LoadTestingResourceCollection loadTestingCollection = _resourceGroup.GetLoadTestingResources();
string loadTestResourceName = "sample-loadtest";
Response<LoadTestingResource> loadTestingResponse = await loadTestingCollection.GetAsync(loadTestResourceName);
LoadTestingResource resource = loadTestingResponse.Value;

ArmOperation loadTestDeleteResponse = await resource.DeleteAsync(WaitUntil.Completed);

Quota Operations

Get Load Testing quota collection.

LoadTestingQuotaCollection QuotaCollection = _subscription.GetAllLoadTestingQuota(AzureLocation.WestUS2);
// Use the quotaCollection for all the quota operations.

Get quota values for a particular quota bucket.

LoadTestingQuotaCollection QuotaCollection = _subscription.GetAllLoadTestingQuota(AzureLocation.WestUS2);

// Get the quota values for a particular quota bucket
Response<LoadTestingQuotaResource> quotaResponse = await QuotaCollection.GetAsync("maxConcurrentTestRuns");
LoadTestingQuotaResource quotaBucket = quotaResponse.Value;

Get quota values for all quota buckets.

LoadTestingQuotaCollection QuotaCollection = _subscription.GetAllLoadTestingQuota(AzureLocation.WestUS2);

// Get the quota values for a all quota buckets
List<LoadTestingQuotaResource> quotaBuckets = await QuotaCollection.GetAllAsync().ToEnumerableAsync();

Check quota availability.

LoadTestingQuotaCollection QuotaCollection = _subscription.GetAllLoadTestingQuota(AzureLocation.WestUS2);

Response<LoadTestingQuotaResource> quotaResponse = await QuotaCollection.GetAsync("maxConcurrentTestRuns");
LoadTestingQuotaResource quotaResource = quotaResponse.Value;

LoadTestingQuotaBucketDimensions dimensions = new LoadTestingQuotaBucketDimensions("<subscription-id>", AzureLocation.WestUS2);
LoadTestingQuotaBucketContent quotaAvailabilityPayload = new LoadTestingQuotaBucketContent(
    quotaResponse.Value.Data.Id,
    quotaResource.Data.Name,
    quotaResource.Data.ResourceType,
    null,
    quotaResource.Data.Usage,
    quotaResource.Data.Limit,
    50, // new quota value
    dimensions);

Response<LoadTestingQuotaAvailabilityResult> checkAvailabilityResult = await quotaResponse.Value.CheckLoadTestingQuotaAvailabilityAsync(quotaAvailabilityPayload);
// IsAvailable property indicates whether the requested quota is available.
Console.WriteLine(checkAvailabilityResult.Value.IsAvailable);

Code samples for using the management library for .NET can be found in the following locations

Troubleshooting

Next steps

For more information about Microsoft Azure SDK, see 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 (for example, label, comment). Follow the instructions provided by the bot. You'll only need to do this action 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 other questions or comments.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 9,709 11/30/2023
1.1.0-beta.1 519 5/31/2023
1.0.1 15,078 2/17/2023
1.0.0 763 2/1/2023
1.0.0-beta.2 333 1/6/2023
1.0.0-beta.1 173 11/23/2022