Skip to content

When creating new VM in PS , and using New-AzVmssConfig - PlatformFaultDomain is NOT set #17784

Closed
@goraco

Description

@goraco

Description

hello
When I create a new VM:

PlatformFaultDomain is correctly set and it is visible in the VM properties, e,g,

When I get VM properties all is OK PlatformFaultDomain = 2

Get-AzVM -ResourceGroupName gor-vmsstest -Name testvm2

ResourceGroupName : gor-vmsstest
Id : /subscriptions/e663cc2d-722b-4be1-b636-bbd9e4c60fd9/resourceGroups/gor-vmsstest/providers/Microsoft.Compute/virtualMachines/testvm2
VmId : 3fa5a7dd-4861-4a3d-ae00-7186340d2d53
Name : testvm2
Type : Microsoft.Compute/virtualMachines
Location : westeurope
Tags : {"azsecpack":"nonprod","platformsettings.host_environment.service.platform_optedin_for_rootcerts":"true"}
HardwareProfile : {VmSize}
NetworkProfile : {NetworkInterfaces}
OSProfile : {ComputerName, AdminUsername, WindowsConfiguration, Secrets, AllowExtensionOperations, RequireGuestProvisionSignal}
ProvisioningState : Succeeded
StorageProfile : {ImageReference, OsDisk, DataDisks}
VirtualMachineScaleSet : {Id}
PlatformFaultDomain : 2


However, when I create a new Vm with PS, by using New-AzVMConfig (reasom is to use xistign VNET, disks etc.) PlatformFaultDomain is NOT visilble in the VM profile, even when it is specified during the VM ctreation.

here the PS script repro example:

##########

Create VMSS

$RGName = "gor-vmsstest"
$Location = "westeurope"
$VMSSName = "sap-vmss-flex"

$vmssConfig = New-AzVmssConfig -Location $Location -PlatformFaultDomainCount 3
$VMSS = New-AzVmss -ResourceGroupName $RGName -Name $VMSSName -VirtualMachineScaleSet $vmssConfig -Verbose

Create VM

$cred = Get-Credential
$VNETName = "testvm1"
$FaultDomainNumber = 2
$vmName = "testvm3"

$OSDiskName = "$VMname-osdisk"
$NICName = "$VMname-nic"
$NSGName = "$VMname-NSG"
$OSDiskSizeinGB = 128
$VMSize = "Standard_DS2_v2"
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$SKU = "2019-Datacenter"

$RG = Get-AzResourceGroup -Name $RGName
$vnet = Get-AzVirtualNetwork -Name $VNETName

$nsgRuleRDP = New-AzNetworkSecurityRuleConfig -Name RDP -Protocol Tcp -Direction Inbound -Priority 1001 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow

Create a network security group

$nsg = New-AzNetworkSecurityGroup -ResourceGroupName $RGName -Location $location -Name $NSGName -SecurityRules $nsgRuleRDP

Create a virtual network card and associate with public IP address and NSG

$nic = New-AzNetworkInterface -Name $NICName -ResourceGroupName $RGName -Location $location -SubnetId $vnet.Subnets[0].Id -NetworkSecurityGroupId $nsg.Id -EnableAcceleratedNetworking
$vmConfig = New-AzVMConfig -VMName $vmName -VMSize $VMSize -VmssId $VMSS.Id -PlatformFaultDomain $FaultDomainNumber

Set-AzVMOperatingSystem -VM $vmConfig -Windows -ComputerName $vmName -Credential $cred
Set-AzVMOSDisk -VM $vmConfig -StorageAccountType "Premium_LRS" -Caching ReadWrite -Name $OSDiskName -DiskSizeInGB $OSDiskSizeinGB -CreateOption FromImage
Set-AzVMSourceImage -VM $vmConfig -PublisherName $PublisherName -Offer $Offer -Skus $SKU -Version latest
Add-AzVMNetworkInterface -VM $vmConfig -Id $nic.Id

content of $vmConfig BEFORE VM CREATION PlatformFaultDomain=2 OK

$vmConfig

Name : testvm3
HardwareProfile : {VmSize}
NetworkProfile : {NetworkInterfaces}
OSProfile : {ComputerName, AdminUsername, AdminPassword, WindowsConfiguration}
StorageProfile : {ImageReference, OsDisk}
VirtualMachineScaleSet : {Id}
PlatformFaultDomain : 2

Create a virtual machine

New-AzVM -ResourceGroupName $RGName -Location $location -VM $vmConfig

##############

After VM is created PlatformFaultDomain is missing

Get-AzVM -ResourceGroupName gor-vmsstest -Name testvm3

ResourceGroupName : gor-vmsstest
Id : /subscriptions/e663cc2d-722b-4be1-b636-bbd9e4c60fd9/resourceGroups/gor-vmsstest/providers/Microsoft.Compute/virtualMachines/testvm3
VmId : 89de03d3-981c-4de1-ae18-9413709b9046
Name : testvm3
Type : Microsoft.Compute/virtualMachines
Location : westeurope
Tags : {"azsecpack":"nonprod","platformsettings.host_environment.service.platform_optedin_for_rootcerts":"true"}
DiagnosticsProfile : {BootDiagnostics}
Extensions : {BGInfo}
HardwareProfile : {VmSize}
NetworkProfile : {NetworkInterfaces}
OSProfile : {ComputerName, AdminUsername, WindowsConfiguration, Secrets, AllowExtensionOperations, RequireGuestProvisionSignal}
ProvisioningState : Succeeded
StorageProfile : {ImageReference, OsDisk, DataDisks}
VirtualMachineScaleSet : {Id}

Issue script & Debug output

After VM is created  PlatformFaultDomain  is  missing:


Get-AzVM -ResourceGroupName gor-vmsstest -Name testvm3
 
ResourceGroupName      : gor-vmsstest
Id                     : /subscriptions/e663cc2d-722b-4be1-b636-bbd9e4c60fd9/resourceGroups/gor-vmsstest/providers/Microsoft.Compute/virtualMachines/testvm3
VmId                   : 89de03d3-981c-4de1-ae18-9413709b9046
Name                   : testvm3
Type                   : Microsoft.Compute/virtualMachines
Location               : westeurope
Tags                   : {"azsecpack":"nonprod","platformsettings.host_environment.service.platform_optedin_for_rootcerts":"true"}
DiagnosticsProfile     : {BootDiagnostics}
Extensions             : {BGInfo}
HardwareProfile        : {VmSize}
NetworkProfile         : {NetworkInterfaces}
OSProfile              : {ComputerName, AdminUsername, WindowsConfiguration, Secrets, AllowExtensionOperations, RequireGuestProvisionSignal}
ProvisioningState      : Succeeded
StorageProfile         : {ImageReference, OsDisk, DataDisks}
VirtualMachineScaleSet : {Id}

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.7.4                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script     4.24.1                Az.Compute                          {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script     4.15.0                Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayCus

Error output

No response

Metadata

Metadata

Labels

Compute - VMSSService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions