I have a Azure Resource Group and it has a vnet. The vnet has a subnet which has two service endpoints configured namely Microsoft.keyVault and Microsoft.Storage and the subnet also has a subnet delegation to Microsoft.Web/serverFarms.
Now I want to add another service endpoint Microsoft.ServiceBus to the same vnet using Azure Powershell. I executed the below code for that.
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $ResourceGroupName
Set-AzVirtualNetworkSubnetConfig -Name $virtualNetwork.Subnets.Name -VirtualNetwork $virtualNetwork -AddressPrefix $virtualNetwork.Subnets.AddressPrefix -ServiceEndpoint "Microsoft.ServiceBus"
$virtualNetwork | Set-AzVirtualNetwork
But the above code is throwing error at the last line of code saying that the Subnet is missing Required Delegation
Subnet requires any of the following delegation(s) [Microsoft.Web/serverFarms] to reference service association link
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: SubnetMissingRequiredDelegation
But in portal I see it has the required delegation. How to fix this error?