Azure / Azure/azure-powershell

NSG name is not taking correct in New-AzVMSS command

Open
#26,865 3 comments 0 reactions 1 assignee Claimed by @Kanik09 View on GitHub
act-observability-squad bug Compute - VMSS customer-reported Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

Hello Team,

I am trying to create new VMSS using New-AzVmss command as below:

$vmss = New-AzVmss `
-ResourceGroupName $rgName `
-Location $location `
-Name ($vmNamePrefix + $runnerRegionAlias) `
-Credential $Credential `
-VirtualNetworkName $vnetName `
-VnetAddressPrefix $vnetAddressSpace `
-SubnetName $subnetName `
-SubnetAddressPrefix $vnetAddressSpace `
-PublicIpAddressName $publicIpName `
-AllocationMethod Static `
-SecurityGroupName $dataPlaneNsgName `
-OrchestrationMode Uniform `
-InstanceCount 1 `
-Zone 1 `
-UpgradePolicyMode "Automatic" `
-ImageName Win2022AzureEdition `
-SecurityType "TrustedLaunch"

Here the NSG name is not picking as mentioned in the variable, it is picking default value

Image

### Issue script & Debug output

```PowerShell
Hello Team,

I am trying to create new VMSS using New-AzVmss command as below:

$vmss = New-AzVmss `
-ResourceGroupName $rgName `
-Location $location `
-Name ($vmNamePrefix + $runnerRegionAlias) `
-Credential $Credential `
-VirtualNetworkName $vnetName `
-VnetAddressPrefix $vnetAddressSpace `
-SubnetName $subnetName `
-SubnetAddressPrefix $vnetAddressSpace `
-PublicIpAddressName $publicIpName `
-AllocationMethod Static `
-SecurityGroupName $dataPlaneNsgName `
-OrchestrationMode Uniform `
-InstanceCount 1 `
-Zone 1 `
-UpgradePolicyMode "Automatic" `
-ImageName Win2022AzureEdition `
-SecurityType "TrustedLaunch"

Here the NSG name is not picking as mentioned in the variable, it is picking default value

Image
```

### Environment data

```PowerShell
PS C:\NW\Azure-NetworkAnalytics\src\Tools\RunnerDeploymentAutomation> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.22621.4391
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4391
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
PS C:\NW\Azure-NetworkAnalytics\src\Tools\RunnerDeploymentAutomation> Get-Module Az*

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 4.0.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script 9.0.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnatten...
Script 7.11.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-Az...
Script 3.2.1 Az.OperationalInsights {Disable-AzOperationalInsightsIISLogCollection, Disable-Az...
Script 7.7.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDeny...
Script 8.0.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountMa...
```

### Error output

```PowerShell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.