Azure / Azure/azure-cli

Subnet create, unhelping error message if overlapping address range

Open
#10,917 11 comments 0 reactions 1 assignee Claimed by @ramandhillon84 View on GitHub
act-quality-productivity-squad bug customer-reported Network - Virtual Network Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

**Issue:**
Non helping error message

**Command Name**
`az network vnet subnet create`

**Errors:**
```
Subnet 'private-dmz' is not valid in virtual network 'dmz'.
```

## To Reproduce:
The only requirement to reproduce this issue is to create a subnet with an overlapping address range on another subnet (set with the --address-prefixes option) .

### Steps explanation
2) In the following example, we have a 64 address range available in our 'dmz' vnet.
3) We create a first 16 address-ranged subnet (public-dmz). at 10.0.0.0/28 ~[10.0.0.0 - 10.0.0.15]
4) We create a second 32 address-ranged subnet (private-dmz) at 10.0.0.0/27 ~[10.0.0.0 - 10.0.0.32].

The 4th step is the command leading to the imprecise error message.

As you can see, the range of the second subnet 'private-dmz' overlap the first one's range.

### Steps to reproduce the behavior:

1) `az group create -n myGroup`
2) `az network vnet create -g myGroup -n dmz --address-prefixes 10.0.0.0/26`
3) `az network vnet subnet create -g myGroup --vnet-name dmz -n public-dmz --address-prefixes 10.0.0.0/28`
4) `az network vnet subnet create -g myGroup --vnet-name dmz -n private-dmz --address-prefixes 10.0.0.0/27`

Independently of the issue, the correct 4th step would be:
`az network vnet subnet create -g home --vnet-name dmz -n private-dmz --address-prefixes 10.0.0.32/27`

## Expected Behavior
The user is the one who is getting wrong but the occurring error message isn't helping at all in leading the user to resolve the mistake he did.

It would be interesting to append an error message like the following one:
```
New subnet's address range would overlap already existing 'public-dmz' subnet.
````

## Environment Summary
```
Linux-4.15.0-1060-azure-x86_64-with-debian-stretch-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.75

Extensions:
interactive 0.4.3

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.