@Dnyaneshwar Surywanshi Thank you for reaching out.
We sincerely apologize for the delay in getting back to you.
You can use the IpConfigurations property to check if the subnet is already associated with with any other resource.
var network = await azure.Networks.GetByIdAsync("/subscriptions/XXXXX-c5b6-44fb-b5ba-XXXXX/resourceGroups/XXXX-testing/providers/Microsoft.Network/virtualNetworks/vnet90e998400c370f");
foreach (var subnet in network.Inner.Subnets)
{
if (subnet.IpConfigurations == null)
{
Console.WriteLine("Subnet is not associated");
}
else
{
Console.WriteLine("Subnet is already associated");
}
}
Please let us know if you have any further questions.
----------
If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.