I am deploying a langauge service using a bicep file. I set public network access to disabled. In the next step, I setup a private endpoint.
I am getting this error:
Failed to disable Public Access for Azure Search. Additional steps are
required to setup a private link to your Azure Cognitive Search
service.
I tried deploying without setting public network access to disabled, and it worked. This creates the language service and the private endpoint. Then I changed public network access to disabled and depolyed again, which worked.
I think it will not allow me to disable public network access without the private endpoint in place.
How do I get around this?
I don’t see a way to disable public network access without copying all the resource settings in another block. That is messy.
Is there a way to update a single setting? I don’t want to change anything else by omitting it.
Update: I don’t get this problem with I remove the association with the service service.
If I remove this section, it works
apiProperties: {
qnaAzureSearchEndpointId: search.id
qnaAzureSearchEndpointKey: search.listAdminKeys().primaryKey
}
Here is the bicep:
param languageServiceName string = 'lg-usas-loginbot-dev-cus-001'
param searchServiceName string = 'ais-usas-loginbot-dev-cus-001'
param location string = 'CentralUS'
param privateEndpointVnetResourceGroup string = 'rg-hrs-usas-np-inf-01'
param privateEndpointVnet string = 'vnet-hrs-usas-dev-cus'
param privateEndpointSubnet string = 'sn-chatbot-dev-002'
resource search 'Microsoft.Search/searchServices@2024-06-01-preview' existing = {
name: searchServiceName
}
resource language 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' = {
name: languageServiceName
location: location
sku: {
name: 'S'
}
kind: 'TextAnalytics'
properties: {
apiProperties: {
qnaAzureSearchEndpointId: search.id
qnaAzureSearchEndpointKey: search.listAdminKeys().primaryKey
}
customSubDomainName: languageServiceName
networkAcls: {
defaultAction: 'Allow'
virtualNetworkRules: []
ipRules: []
}
publicNetworkAccess: 'Disabled'
}
identity: {
type: 'SystemAssigned'
}
}
resource existingPESubnet 'Microsoft.Network/virtualNetworks/subnets@2022-05-01' existing = {
name: '${privateEndpointVnet}/${privateEndpointSubnet}'
scope: resourceGroup(privateEndpointVnetResourceGroup)
}
resource languagePE 'Microsoft.Network/privateEndpoints@2022-05-01' = {
name: 'pe-${languageServiceName}-as'
location: location
properties: {
privateLinkServiceConnections: [
{
name: 'pe-${languageServiceName}-as'
properties: {
privateLinkServiceId: language.id
groupIds: [
'account'
]
privateLinkServiceConnectionState: {
status: 'Approved'
description: 'Auto-approved'
actionsRequired: 'None'
}
}
}
]
manualPrivateLinkServiceConnections: []
customNetworkInterfaceName: 'nic-${languageServiceName}-as'
subnet: {
id: existingPESubnet.id
}
ipConfigurations: []
}
}
2
Answers
Just tried with a language service and no error:
Posting a new answer as I think the other one can still be relevant for others but not answering your main issue.
So I found this piece of documentation: Network isolation and private endpoints:
I feel that would be best addressed with az cli because of the multiple steps required but managed to get an almost bicep version.
Before the deployment starts, I’m checking if the resources exist to make it idempotent => this also could be done using deploymentScripts but I feel it is over complicated to the purpose of your question.
To piece everything together, I had to create few modules.
search-ai.bicep
search-ai-role-assignment.bicep
language-ai.bicep
main.bicep
Then I can invoke the bicep script like that (using powershell):