Skip to main content Link Menu Expand (external link) Document Search Copy Copied
Table of contents
  1. Virtual network
    1. Create virtual network
    2. Get virtual network info
    3. Create virtual network peering
  2. Subnet
    1. Create subnet
    2. List subnet
    3. Get subnet info
    4. Get available ip

Virtual network

Create virtual network

Get virtual network info

Create virtual network peering

  • Source : https://learn.microsoft.com/fr-fr/cli/azure/network/vnet/peering?view=azure-cli-latest#az-network-vnet-peering-create

    Command error

    Unable to create peering with az cli !!!

    $aksresourceGroup    = "rg-aks-bootstrap-networking-spoke"
    $vnetName            = "vnet-spoke"
    $vnetHubName         = "vnet-hub"
    $hubResourceGroup    = "rg-francecentral-networking-hub"
    
    az network vnet peering create --name np-to-vnet-hub --vnet-name $vnetName --remote-vnet $vnetHubName  --resource-group $aksresourceGroup --allow-vnet-access --allow-forwarded-traffic 
    
    
  • Source : https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_virtualnetworkpeering_module.html#ansible-collections-azure-azcollection-azure-rm-virtualnetworkpeering-module

    - name: Create virtual network_peering
      azure.azcollection.azure_rm_virtualnetworkpeering:
        name:                         'np-to-{{ _virtual_network_peering.target.name }}'
        resource_group:               '{{  _virtual_network_peering.source.resource_group }}'
        virtual_network:              '{{  _virtual_network_peering.source.name }}'
        allow_virtual_network_access: '{{  _virtual_network_peering.allow_virtual_network_access | default(false) }}'
        allow_forwarded_traffic:      '{{  _virtual_network_peering.allow_forwarded_traffic | default(false) }}'
        remote_virtual_network:
          resource_group: '{{ _virtual_network_peering.target.resource_group }}'
          name:           '{{ _virtual_network_peering.target.name }}'
      vars:
        _virtual_network_peering:
          allow_virtual_network_access: true
          allow_forwarded_traffic: true
          source:
            name:           'vnet-hub'
            resource_group: 'rg-francecentral-networking-hub'
          target:
            name:           'rg-aks-bootstrap-networking-spoke'
            resource_group: 'vnet-spoke'
      
    

Subnet

Create subnet

List subnet

Get subnet info

Get available ip