Skip to content

Subnet Creation API Providing Incorrect Subnet #354

@tonydean37

Description

@tonydean37

Hi Matt, long time no speak. Hope all is well with you? We updated our IPAM to the latest version (3.5.0) yesterday and this morning seen a bit of an issue with subnet as below.

Describe the bug
We are using the subnet API Tool to get an unused subnet from within a Vnet, but IPAM is returning a subnet that cannot be used.

To Reproduce
Use the script:
$requestUrl = "https://$ipamAppName.azurewebsites.net/api/tools/nextAvailableSubnet"
$body = @{
vnet_id = "redacted"
smallest_cidr = "true"
size = $size
} | ConvertTo-Json

$headers = @{
    'Accept'       = 'application/json'
    'Content-Type' = 'application/json'
}

$response = Invoke-RestMethod `
    -Method 'Post' `
    -Uri $requestUrl `
    -Authentication 'Bearer' `
    -Token $accessToken `
    -Headers $headers `
    -Body $body

PS C:\repos> ($responseBLock | Where-Object {$_.name -eq "redacted"}).prefixes
10.171.129.0/24
10.168.255.128/27
10.171.44.0/25
10.168.255.160/27
10.171.44.128/25
10.171.48.0/22
10.171.45.0/24
10.171.46.0/24
PS C:\repos>
PS C:\repos> $response

vnet_name resource_group subscription_id cidr


redacted 10.171.44.0/24

Expected behavior
Should have provided a /25

Desktop (please complete the following information):
Using Powershell locally and in a pipeline provides the same issue

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions