Getting error while creating Azure Batch Pool with private network configuration.
BatchClient bClient = BatchClient.Open(new BatchSharedKeyCredentials(batchUri, accountName, accountKey));
PoolSpecification poolSp = new PoolSpecification();
poolSp.NetworkConfiguration = new NetworkConfiguration
{
SubnetId = "/subscriptions/{0}/resourceGroups/{1}/providers/{2}/virtualNetworks/{3}/subnets/{4}"
};
Getting errors when creating job
await job.CommitAsync();
Exception: Microsoft.Azure.Batch.Protocol.Models.ErrorMessage - AuthenticationFailed AuthenticationErrorDetail: The specified type of authentication SharedKey is not allowed when external resources of type Network are linked.
After research, I found that it is mandatory to use AAD authentication when using VNET. The reason is when using a shared key, the key doesn't have permission to access Network resources.
You can read the article mentioned in Authenticate Batch service solutions with Active Directory.