下面的二头肌创建了一个 Azure 搜索服务。第一次运行时,它会在大约 5 秒内按预期创建搜索服务。如果我再次运行它,它会在很长一段时间后失败(超过 2 小时 - 我正在等待确切的时间)。
资源组的部署详细信息显示状态为 InternalServerError。 操作详情作为此状态消息:
{
"status": "Failed",
"error": {
"code": "Unknown",
"message": "{\"error\":{\"code\":\"\",\"message\":\"An error has occurred.\"}} This could be a transient error, try to disable and enable all identities for the service and retry the operation. RequestId: f6910fa8-fa5c-4e2d-838e-c22335731c5d"
}
}
知道发生了什么吗?
如何解决此问题,或获取有关该 requestId 的更多信息?
这是二头肌:
param searchServiceName string
param location string
resource search 'Microsoft.Search/searchServices@2024-06-01-preview' = {
location: location
properties: {
replicaCount: 1
partitionCount: 1
hostingMode: 'default'
publicNetworkAccess: 'Enabled'
networkRuleSet: {
ipRules: []
bypass: 'None'
}
encryptionWithCmk: {
enforcement: 'Unspecified'
}
disableLocalAuth: false
authOptions: {
apiKeyOnly: {}
}
disabledDataExfiltrationOptions: []
semanticSearch: 'disabled'
}
name: searchServiceName
sku: {
name: 'standard'
}
}
如果资源存在,SearchService 部署失败
我们无法指定问题的具体原因,因为只有当您第二次或多次运行此配置时才会遇到此问题。
但是错误描述我们可以说您正在使用托管身份来完成这件事。如果服务标识之前已分配且未正确清理,则后续配置尝试可能会失败。
禁用并重新启用服务的托管身份并确保其已正确分配。
当我尝试从我的一端做同样的事情时,当我没有对托管身份进行任何更改时,我能够多次运行代码。
配置:
param searchServiceName string
param location string
resource search 'Microsoft.Search/searchServices@2024-06-01-preview' = {
location: location
properties: {
replicaCount: 1
partitionCount: 1
hostingMode: 'default'
publicNetworkAccess: 'Enabled'
networkRuleSet: {
ipRules: []
bypass: 'None'
}
encryptionWithCmk: {
enforcement: 'Unspecified'
}
disableLocalAuth: false
authOptions: {
apiKeyOnly: {}
}
disabledDataExfiltrationOptions: []
semanticSearch: 'disabled'
}
name: searchServiceName
sku: {
name: 'standard'
}
}
部署:
这是我第二次运行已经存在的相同脚本。
参考:
https://learn.microsoft.com/en-us/azure/automation/disable-management-identity-for-automation
按照此操作禁用并重新设置托管身份。
https://learn.microsoft.com/en-us/azure/search/search-get-started-bicep?tabs=CLI