Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Vnet Prefix via PowerShell #105743

Closed
alinedutrasilva opened this issue Feb 24, 2023 · 2 comments
Closed

Changing Vnet Prefix via PowerShell #105743

alinedutrasilva opened this issue Feb 24, 2023 · 2 comments

Comments

@alinedutrasilva
Copy link

alinedutrasilva commented Feb 24, 2023

Hello Team,

I have noticed that this page did not mention the possibility of change the Vnet prefix via PowerShell.

Indeed, via Azure Portal does not allow it due to validation:

image

However, if you perform the same action via PowerShell, it allows you to change the same Vnet without any issue:

$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName testvnet -Name testvnet
$virtualNetwork.AddressSpace.AddressPrefixes.Remove("10.230.195.0/24")
True
$virtualNetwork.AddressSpace.AddressPrefixes.Add("10.230.195.0/26")
$virtualNetwork.AddressSpace.AddressPrefixes.Add("10.230.195.64/26")
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork

image

Documentation:
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-manage-subnet
https://learn.microsoft.com/en-us/azure/virtual-network/manage-virtual-network

Thank you for reviewing.

Aline Dutra


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@AjayBathini-MSFT
Copy link
Contributor

@alinedutrasilva
Thanks for your feedback! We will investigate and update as appropriate.

@ChaitanyaNaykodi-MSFT
Copy link
Contributor

@alinedutrasilva
Thank you for sharing your feedback.
From the images shared above seems like you are trying to add an address space to your virtual network. The required PowerShell commands are currently documented here. Thank you!

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

No branches or pull requests

3 participants