Home > Blockchain >  creating vnet and subnet using python sdk
creating vnet and subnet using python sdk

Time:10-25

Can anyone please guide me on how to achieve the below using python sdk which i have tested from powershell .

$vnet = @{
    Name = 'myVNet'
    ResourceGroupName = 'CreateVNetQS-rg'
    Location = 'EastUS'
    AddressPrefix = '10.0.0.0/16'    
}
$virtualNetwork = New-AzVirtualNetwork @vnet
$subnet = @{
    Name = 'default'
    VirtualNetwork = $virtualNetwork
    AddressPrefix = '10.0.0.0/24'
}
$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subnet
$virtualNetwork | Set-AzVirtualNetwork

I have followed this document : enter image description here

enter image description here

Reference:

You can change the parameters as per your requirement , for that you can refer the below references:

VirtualNetwork Class

Subnet Class

  • Related