azure - How to update existing AzureRm virtual network using PowerShell? -
context
i have existing rm virtual network, , add new subnet using powershell:
# create subnet config: $besub = new-azurermvirtualnetworksubnetconfig -name $besubname -addressprefix $besubprefix # vnet $vnet = get-azurermvirtualnetwork -name $vnetname -resourcegroupname $vmresourcegroup # add subnet: add-azurermvirtualnetworksubnetconfig -name $besubname -addressprefix $besubprefix -virtualnetwork $vnet
all commands run no subnet added virtual network.
what i've try far:
- originally i've thought there should
update-azurermvirtualnetwork
, there no such command. - i've searched new-azurermvirtualnetworksubnet, has -virtualnetwork $vnet parameter no success.
question
how can add new rm subnet existing rm virtual network?
you close. you're creating config not getting applied. script below you.
# vnet $vnet = get-azurermvirtualnetwork -name $vnetname -resourcegroupname $vmresourcegroup # add subnet config vnet: add-azurermvirtualnetworksubnetconfig -name $besubname -addressprefix $besubprefix -virtualnetwork $vnet # apply subnet config vnet: set-azurermvirtualnetwork -virtualnetwork $vnet
Comments
Post a Comment