Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Recently I had an ask from a developer to check Azure Powershell Command let> New-AzureBatchPool script execution issue. He wanted to specify the VNet details as a parameter to this command so that the batch pool nodes would created with this detail. Unfortunately, we did not have any sample to refer or validate parameter. We spent quite amount of time tweaking the parameter to see the effect but no luck. Lately found a link where these details are explained enough to try on our own.
Please note, failing to follow these condition would throw errors . Suggest to start this https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#pool-network-configuration and also this https://msdn.microsoft.com/library/azure/dn820174.aspx#bk_netconf. Each and every condition in the below list matters.
Working Powershell command let for easy reference:-
Add-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName "xxxxx Azure xxx xxxx - xxxx"
$batchcontext = Get-AzureRmBatchAccountKeys -AccountName nicoloasbatch
$objectvnetconf = New-Object -TypeName Microsoft.Azure.Commands.Batch.Models.PSNetworkConfiguration
$objectvnetconf.SubnetId = "/subscriptions/xxxxxxxxxxxxxxxxxx/resourceGroups/nicoloasbatch/providers/Microsoft.ClassicNetwork/virtualNetworks/nicolasclassicvnet/subnets/mysubnet1"
$configuration = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSCloudServiceConfiguration" -ArgumentList @(4,"*")
New-AzureBatchPool -Id "MikkybatchPool" -VirtualMachineSize "Small" -TargetDedicated 1 -BatchContext $batchcontext -NetworkConfiguration $objectvnetconf -CloudServiceConfiguration $configuration
How to specify RBAC details, explained in screenshots.
> The "MicrosoftAzureBatch" service principal must have the "Classic Virtual Machine Contributor" Role-Based Access Control (RBAC) role for the specified VNet. If the specified RBAC role is not given, the Batch service returns 400 (Bad Request).
How to verify whether it is successfully executed or not.
Reference:-
Pool network configuration- https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#pool-network-configuration
Add a pool to an account(networkConfiguration) https://msdn.microsoft.com/library/azure/dn820174.aspx#bk_netconfhttps://msdn.microsoft.com/library/azure/dn820174.aspx#bk_netconf
Thanks to Marie-Magdelaine Nicolas for sharing the powershell command let.
Please sign in to use this experience.
Sign in