I am creating Application gateway using ARM templete now I want to check after select the virtual network subnet should not be allocated any other resource if allocated then show the message like Subnet must have only have Application Gateway.
According to my understanding, you want to list all resources that are connected to the virtual network. If so, you can use the rest API Get Virtual Networks
.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}}?api-version=2020-07-01
If one subnet has been allocated any other resource, it will return these configurations in subnet
property. For more details, please refer to here.
For example