I have created the service bus namespace using bicep and also created Private Endpoint for the service bus, but privatenedpoints are not deploying. Do I need to add subnets for creating private endpoints?
param service_bus_private_endpoint_Name string
param subscriptionsID string
param resourceGroupName string
PrivateEndpointId : param privateEndpointId string= '/subscriptions/${subscriptionsID}/resourceGroups/${resourceGroupName}/providers/Microsoft.Network/privateEndpoints/${service_bus_private_endpoint_Name}'
resource privateEndpointConnections 'Microsoft.ServiceBus/namespaces/privateEndpointConnections@2022-10-01-preview' = {
name: service_bus_private_endpoint_Name
properties: {
privateEndpoint: {
id : privateEndpointId
}
privateLinkServiceConnectionState: {
description: 'Approved'
status: 'Auto-Approved'
}
provisioningState: 'Succeeded'
}
}
Yes, every private endpoint must be associated to a subnet during the deployment, as it will in practice have a network interface "attached" to this subnet.
You can refer to this example from the official documentation for creating private endpoints using Bicep, where you can see it defines a vnet, a subnet and then the private endpoint referring the subnet and the sub-resource (in your case the servicebus namespace).
https://learn.microsoft.com/en-us/azure/private-link/create-private-endpoint-bicep?tabs=CLI