Skip to content

[Fixes] VM - Update NIC IP Address handover#1677

Merged
AlexanderSehr merged 5 commits into
Azure:mainfrom
chris5287:patch-1
Jul 17, 2022
Merged

[Fixes] VM - Update NIC IP Address handover#1677
AlexanderSehr merged 5 commits into
Azure:mainfrom
chris5287:patch-1

Conversation

@chris5287
Copy link
Copy Markdown
Contributor

@chris5287 chris5287 commented Jul 15, 2022

Description

Fixes #1676

The ipConfiguration.vmIPAddress property within the Virtual Machine module is sent via a nested bicep resource to the Network Interfaces module using privateIPAddress, instead of vmIPAddress

I would assume we cannot update the Network Intefaces modules to align to the privateIPAddress property (as that would be a break public interface, so I guess the fix is to map the Virtual Machine nested bicep to use vmIPAddress throughout.

1st nested layer:

privateIPAddress: contains(ipConfiguration, 'vmIPAddress') ? (!empty(ipConfiguration.vmIPAddress) ? ipConfiguration.vmIPAddress : null) : null

2nd nested layer:

privateIPAddress: contains(ipConfiguration, 'vmIPAddress') ? (!empty(ipConfiguration.vmIPAddress) ? ipConfiguration.vmIPAddress : null) : null

To reproduce

Example Bicep module call below

module vm 'main/modules/Microsoft.Compute/virtualMachines/deploy.bicep' = {
  name: '${deployment().name}_vm'
  params: {
    name: 'name'
    imageReference: {
      publisher: 'zscaler'
      offer: 'zscaler-private-access'
      sku: 'zpa-con-azure'
      version: 'latest'
    }
    vmSize: 'Standard_D4s_v3'
    adminUsername: 'azure-username'
    adminPassword: 'supersecretpassword'
    osType: 'Linux'
    osDisk: {
      diskSizeGB: '16'
      managedDisk: {
        storageAccountType: 'StandardSSD_LRS'
      }
    }
    nicConfigurations: [
      {
        nicSuffix: '-nic-01'
        enableAcceleratedNetworking: true
        ipConfigurations: [
          {
            name: 'ipconfig01'
            subnetId: '/subscriptions/...../subnets/....'
            privateIPAllocationMethod: 'Static'
            vmIPAddress: '192.168.10.10'
          }
        ]
      }
    ]
  }
}

Type of Change

Please delete options that are not relevant.

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

@chris5287 chris5287 marked this pull request as ready for review July 15, 2022 21:09
@chris5287 chris5287 requested a review from a team as a code owner July 15, 2022 21:09
@AlexanderSehr AlexanderSehr added bug Something isn't working [cat] modules category: modules labels Jul 16, 2022
@AlexanderSehr AlexanderSehr changed the title Update nested_networkInterface.bicep [Fixes] VM - Update NIC IP Address handover Jul 16, 2022
Comment thread modules/Microsoft.Compute/virtualMachines/.bicep/nested_networkInterface.bicep Outdated
@ghost
Copy link
Copy Markdown

ghost commented Jul 16, 2022

CLA assistant check
All CLA requirements met.

@chris5287 chris5287 requested a review from AlexanderSehr July 16, 2022 11:39
Comment thread modules/Microsoft.Network/networkInterfaces/deploy.bicep
@chris5287 chris5287 requested a review from AlexanderSehr July 16, 2022 19:54
@AlexanderSehr AlexanderSehr enabled auto-merge (squash) July 17, 2022 16:31
@AlexanderSehr AlexanderSehr merged commit 6f10dd1 into Azure:main Jul 17, 2022
@AlexanderSehr
Copy link
Copy Markdown
Contributor

Thank you for your contribution @chris5287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working [cat] modules category: modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report]: Cannot deploy Virtual Machine with Static IP Address

2 participants