Skip to content

Assign existing vnet in bicep file #9791

Answered by ElYusubov
derekgrus asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @derekgrus,

// Try to declare an existing VNet, like in the following sample:
// And then declare you NIC with an existing VNet and a subnet.
 
 resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-05-01' existing = {
  name: virtualNetworkName
}

resource nic 'Microsoft.Network/networkInterfaces@2022-05-01' = {
  name: nicName
  location: location
  properties: {
    ipConfigurations: [
      {
        name: 'ipconfig1'
        properties: {
          privateIPAllocationMethod: 'Dynamic'
          publicIPAddress: {
            id: publicIp.id
          }
          subnet: {
            id: resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnetNa…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
6 replies
@derekgrus
Comment options

@ElYusubov
Comment options

@cbg-branabhat
Comment options

@uky2019
Comment options

@cbg-branabhat
Comment options

Answer selected by derekgrus
Comment options

You must be logged in to vote
1 reply
@cbg-branabhat
Comment options

Comment options

You must be logged in to vote
3 replies
@cbg-branabhat
Comment options

@uky2019
Comment options

@cbg-branabhat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants