Option List For Azure Subnets

Can we create an option list for Azure Subnets, I created an option list for Networks using Morpheus API but it fetches only the VNET not all the subnets residing into it.

Request Script

if (input.Cloud && input.Group) {
results.cloudId = input.Cloud
results.groupId = input.Group
}

Translation Script

if (input.Cloud && input.Group) {
for (var x = 0; x < data.length; x++) {
results.push({name:data.name, value:data.id});
}
}

Have you tried the “Instance Networks” Morpheus API type? I think that can pull in subnets as well.

1 Like

The following translation script and request script can be used to fetch the subnets. To fetch only azure subnets you will need to specify the ‘ProvionTypeId’ which in my case was 2 for Azure.

//Transalation Script
for(var x=0;x < data.length; x++) {
  var isSubnet = data[x].value.includes("subnet");
  if (isSubnet){//Only show subnets
    results.push({name: data[x].name,value:data[x].id});
    }
  }
//Request Script
results.siteId = 1; //Group ID
results.zoneId = 3; // Cloud ID
provisionTypeId=2; //ProvionTypeId 2 = Azure

I see bunge’s post, and did not identify this suggested fix is in combination with the “Instance Networks” API.

The documentation infers that “Instance Networks” is just a pre-filtered “Networks” API Type.

However, I am getting the correct value now utilizing “Instance Networks”, where as I have been struggling with “Networks” to get the mysterious “subnet-###” value. So “Instance Networks” actually is doing something else behind the scenes, or our version of Morpheus is incompatible with doing this on the “Networks” type.

Much appreciate this insight, and really hoping this will be captured in the Morpheus Documentation pages officially!

1 Like

Asked for our documentation to be updated to reflect additional notes!