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.

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