0

I keep getting this error in my Azure batch account: "Allocation failed due to marketplace purchase". My pool allocation is set to "User subscription". I have tried multiple things already, but without success.

I followed the steps from this blog: https://techcommunity.microsoft.com/t5/azure-paas-blog/azure-batch-pool-resizing-failed-allocation-failed-due-to/ba-p/2794640

The weird thing is that the following indeed seems to indicate an issue:

Get-AzMarketplaceTerms -Publisher 'microsoft-azure-batch' -Product 'ubuntu-server-container' -Name '20-04-lts' 

Name      Product Publisher             Accepted Signature PrivacyPolicyLink
----      ------- ---------             -------- --------- -----------------
20-04-lts         microsoft-azure-batch   

The indicated next step raises an Exception:

Get-AzMarketplaceTerms -Publisher 'microsoft-azure-batch' -Product 'ubuntu-server-container' -Name '20-04-lts' | Set-AzMarketplaceTerms -Accept 
Exception: /usr/local/share/powershell/Modules/Az.MarketplaceOrdering/2.0.0/exports/ProxyCmdletDefinitions.ps1:537
Line |
 537 |          $steppablePipeline.Begin($PSCmdlet)
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Name' because it is an empty string.

Therefore I tried the following, which looks as though it works:

Set-AzMarketplaceTerms -Publisher 'microsoft-azure-batch' -Product 'ubuntu-server-container' -Name '20-04-lts' -Accept
Name      Product                 Publisher             Accepted Signature
----      -------                 ---------             -------- ---------                                                         
20-04-lts ubuntu-server-container microsoft-azure-batch True    ...

However, when I rerun the Get-AzMarketplaceTerms command directly after it, nothing has changed, and most importantly I still get the error in the Batch account.

I also tried to accept using the azure cli, also without success..

az vm image terms accept --offer ubuntu-server-container --publisher microsoft-azure-batch --sku 20-04-lts

The above does seem to work as

az term show --product ubuntu-server-container --plan 20-04-lts --publisher microsoft-azure-batch
{
  "accepted": true,
  "id": "..",
  "licenseTextLink": "",
  "marketplaceTermsLink": "",
  "name": "20-04-lts",
  "plan": "20-04-lts",
  "privacyPolicyLink": "https://privacy.microsoft.com/privacystatement",
  "product": "ubuntu-server-container",
  "publisher": "microsoft-azure-batch",
  "retrieveDatetime": "2023-01-24T15:18:01.7673435Z",
  "signature": ".."
  "systemData": {
    "createdAt": "2023-01-24T15:18:01.814201+00:00",
    "createdBy": "..",
    "createdByType": "ManagedIdentity",
    "lastModifiedAt": "2023-01-24T15:18:01.814201+00:00",
    "lastModifiedBy": "2387a668-4176-44f4-8d08-4c689b1af0ba",
    "lastModifiedByType": "ManagedIdentity"
  },
  "type": "Microsoft.MarketplaceOrdering/offertypes"
}

Is there anything else I can do or what I'm missing here? Any help is really appreciated :)

Robin
  • 1

1 Answers1

0

I tried to reproduce the same in my environment I got the results successfully like below.

I have created an azure batch account with pool allocation mode as a user subscription like the below:

enter image description here

I was able to create a batch pool with Ubuntu and canonical images available by default in my Subscription. I tried assigning another Publisher with a Windows server and was able to get it in Portal:-

In my case, In batch pool windows server as not show in the pool publisher like below:

enter image description here

When I try to add a virtual machine configuration publisher as a windows server in windows PowerShell ISE(Run as administrator) It executes successfully like below :

Get-AzMarketplaceTerms -Publisher 'microsoftwindowsserver' -Product 'windowsserver' -Name '2019-datacenter-core-smalldisk'

enter image description here

Now, Go to batch account -> pool -> Add

You will be able to see the windows server like below and add it.

enter image description here

Make sure to add your user as owner, contributor and Microsoft azure batch Rbac role assignment.

Sourav
  • 814
  • 1
  • 9
Imran
  • 3,875
  • 2
  • 3
  • 12