This client library provides access to the Microsoft Azure Batch service.
$ dotnet add package Microsoft.Azure.BatchThe Azure Batch C# client is now under the MIT license. Prior to March 10 2017 it was under the Apache 2.0 license.
Microsoft.Azure.Batch.sln is your one stop shop for all things related to the Azure Batch C# client library. This solution file contains all of the projects affiliated with the Azure Batch client (including testing and tooling).
Depending on the type of change you want to make, the work required varies. If you follow this process you shouldn't miss anything:
src\GeneratedProtocol folder using the steps below.Tools\ObjectModelCodeGenerator\Spec.
src\Generated folder from the convenience layer specification file using the steps below.Generated objects into partial classes located in the src directory.
[Obsolete] attribute or to add some helper factory methods.src\IProtocolLayer.cs interface.src\ProtocolLayer.cs class.PoolOperations.cs.CloudPool.cs.Azure.Batch.Unit.Tests for unit tests. These tests do not have any external dependencies (they run entirely in-memory) and are used in the continuous integration job to validate checkins.BatchClientIntegrationTests for integration tests. These tests run against a live Azure Batch endpoint and do not run during CI. See running the end to end tests for more details about how to run these tests.CHANGELOG.md file and the Version tag in src/Microsoft.Azure.Batch.csproj. Ensure that if you are making a breaking change, you update the major version of the version number.src\GeneratedProtocol folder using AutoRestThe GeneratedProtocol folder holds the code generated by the AutoRest tool from a Swagger specification. The AutoRest tool has a command line interface of its own which you can use directly, or you can run powershell Start-AutoRestCodeGeneration -ResourceProvider "batch/data-plane" -SdkRepoRootPath "<path to root of this repo>" -AutoRestVersion "latest" -SdkGenerationDirectory "<path to root of this repo>\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol" -ConfigFileTag "package-2020-03.11.0"
src\Generated folderThis folder contains the convenience layer models for Azure Batch. It is generated from a custom tool. The custom tool reads all of the specification files located in Tools\ObjectModelCodeGenerator\Spec. The convenience layer models require more metadata than the Swagger specification provides, so this file is an extra mapping layer on top of Swagger which provides more detail. Note: These specification files are all about the models, they have nothing to do with the actual APIs.
There are a number of special flags which have meaning in the specification files. The easiest way to see a list of what flags are supported and at what level is to look at the backing code generation code:
Tools\ObjectModelCodeGeneration\CodeGenerationLibrary\PropertyData.csTools\ObjectModelCodeGeneration\CodeGenerationLibrary\ObjectModelTypeData.csOnce you have added and updated the required files in Tools\ObjectModelCodeGenerator\Spec mark the ObjectModelCodeGenerator as your startup project in Visual Studio and run it -- it will regenerate the contents of the src\Generated folder.
A full end to end test pass takes 20-40 minutes. The following environment variables must be set for the the end to end tests to work - it is recommended to set up a script which sets these all so that it can easily be reused later:
MABOM_BatchAccountEndpoint: The endpoint for your Batch account, i.e. https://<account>.<region>.batch.azure.comMABOM_BatchAccountSubscriptionId: The subscription id that your Batch and Storage accounts are in. Please note your storage account and your Batch account need to be in the same subscription.MABOM_BatchAccountResourceGroupName: The resource group your Batch account is in.MABOM_BatchAccountName: The name of your Batch account.MABOM_BatchAccountKey: The key of your Batch account.MABOM_StorageAccountResourceGroupName: The name of the resource group of your storage account.MABOM_StorageAccount: The name of your storage account.MABOM_StorageKey: The key to your storage account.MABOM_BlobEndpoint: The blob endpoint for the storage account, i.e. https://<account>.blob.core.windows.netMABOM_BatchManagementEndpoint: The management endpoint for the tenant you are targeting. This will usually be https://management.azure.com/.MABOM_AzureAuthenticationClientId: The client ID of an AAD App Registration with contributor access to the subscription you're using (#2).MABOM_AzureAuthenticationClientSecret: The secret for the App Registration (#11).If running the tests against a test tenant, you also must set:
MABOM_BatchTRPExtraHeaders to x-ms-version=2015-12-01;x-ms-client-tenant-id=microsoft.onmicrosoft.comMABOM_BatchTRPCertificateThumbprint: The thumbprint used to authenticate with the Batch Resource Provider.