简体   繁体   中英

Azure - Remove or dissociated an NSG from a subnet using Rest Api

I am trying to run the following command to remove an unused Network Security Group in Azure but the command keeps returning "subnets/default cannot be null or empty."??

 let subnetParameters = { id: "/subscriptions/MysubscriptionId/resourceGroups/helloStorageResouceGrp/providers/Microsoft.Network/virtualNetworks/helloStorageResouceGrpvnet860/subnets/default", networkSecurityGroup: { id:'/subscriptions/MySubscription/resourceGroups/helloStorageResouceGrp/providers/Microsoft.Network/networkSecurityGroups/babNewMachineForEncryption-nsg', name: null } } let resourceGroupName = 'helloStorageResouceGrp'; let virtualNetworkName = 'helloStorageResouceGrpvnet860'; let subnetName = 'default'; let removeSecurityGroup = await NetworkManagement.subnets.createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters) console.log('removeSecurityGroup: ', JSON.stringify(removeSecurityGroup));

try doing this instead:

let subnetParameters = {
     id: "/subscriptions/MysubscriptionId/resourceGroups/helloStorageResouceGrp/providers/Microsoft.Network/virtualNetworks/helloStorageResouceGrpvnet860/subnets/default",
     networkSecurityGroup: {}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM