Azure powershell Error: GenericArguments[0], 'Microsoft.Azure.Management.Compute.Models.VirtualMachine', on 'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' violates the constraint of type 'T'.

Riyaz 71 Reputation points
2022-12-07T15:43:18.64+00:00

Hi There,

I am in middle of creating public load balancer to share workload between a couple of VMs.
Though, in the initial step itself I've blockade of powershell error. The below snippet throughs error.

$as = New-AzAvailabilitySet -ResourceGroupName $rgName -Location $location `
-Name MyAvailabilitySet -Sku Aligned -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 2

Error: New-AzAvailabilitySet: GenericArguments[0], 'Microsoft.Azure.Management.Compute.Models.VirtualMachine', on 'T MaxIntegerT' violates the constraint of type 'T'.

what could have caused to this, your assistance much appreciated.

Regards

Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
404 questions
{count} votes

3 answers

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 23,031 Reputation points Microsoft Employee
    2022-12-08T01:44:21.027+00:00

    @Riyaz ,

    Welcome to the Microsoft Q&A forum.

    The issue above appears to be related to the AutoMapper package as described here. Can you try using PS preview 7.3.0.4 version as discussed in the thread and see if that resolves the issue.

    As a work around you can also run the command via cloud shell as and see if that resolves the issue. I tried it on my end and was able to execute the command on the Cloud Shell.

    268406-image.png

    Hope this Helps! Please let me know if you have any questions. Thank you!

    0 comments No comments

  2. ADM-Sumit Gupta 0 Reputation points
    2023-02-09T10:09:07.44+00:00

    Its still the same issue even on 7.3.2 version and 7.4.0 preview version.. its strange Microsoft didn't get this fix in months. SO to get my work back again i have to rollback to 7.2.7 version.


  3. Carlos Baia Mendes 0 Reputation points
    2024-01-31T09:10:36.1333333+00:00

    Same issue and an update of the Az modules solved the issue!

    0 comments No comments