azure-batch-samples icon indicating copy to clipboard operation
azure-batch-samples copied to clipboard

BatchManagementClient example uses ADAL, which is out of support in December 2022

Open Chris-Johnston opened this issue 3 years ago • 2 comments

I've been referring to these samples to figure out how to use the BatchManagementClient. (The other Batch client doesn't support user-assigned managed identity) The package Microsoft.IdentityModel.Clients.ActiveDirectory is deprecated and will stop receiving updates in December 2022 (3 months as of writing).

https://github.com/Azure-Samples/azure-batch-samples/blob/079a7d24b129bdd21a12efe81bdd54f0c1211aa3/CSharp/AccountManagement/AccountManagement.csproj#L15

The sample should be updated to instead use Microsoft.Identity.Client, which would look something like this. It would also be great to update beyond .net462.

var cred = new DefaultAzureCredential(false); // I'm running this on an azure function, with system managed identity.
var token = cred.GetTokenAsync(new TokenRequestContext(new string[]
{
    "https://management.core.windows.net/",
}));
using var batchManagementClient = new BatchManagementClient(new TokenCredentials(token.Result.Token));

Chris-Johnston avatar Sep 14 '22 22:09 Chris-Johnston

Is this going to be addressed? ADAL, really. FOR SHIZZZLLLEEE.

BC89 avatar Feb 15 '23 22:02 BC89