我正在尝试将两个虚拟机部署到同一个虚拟网络。但我遇到了一个相当模糊的错误。我正在使用Azure Bicep,它随后构建了一个ARM模板。然后将ARM模板添加到Octopus Deploy,在其中我正在使用“DEPLOY AN AZURE RESOURCE MANAGER TEMPLATE”
Status: Conflict
March 28th 2023 16:28:37Error
Provisioning State: Failed
March 28th 2023 16:28:37Error
Status Message: {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","target":null,"details":[{"code":"MethodNotAllowed","message":"{\r\n \"Message\": \"The requested resource does not support http method 'PUT'.\"\r\n}","target":null,"details":null,"additionalInfo":null}],"additionalInfo":null}}
在发生此错误之前,已为第一个VM创建了以下资源:
在VNet模块中
- Microsoft.Network/networkSecurityGroups@2021-02-01
- Microsoft.Network/virtualNetworks@2021-02-01
在VM模块中
- Microsoft.Storage/storageAccounts@2021-04-01
- Microsoft.Network/publicIPAddresses@2021-02-01
- Microsoft.Network/networkInterfaces@2021-02-01
VM本身和第2个VM的所有东西都没有创建。我正在使用模块创建VM和虚拟网络+安全组。我最好的猜测是虚拟机或网络接口出了问题,因为在网络接口之后,它抛出了错误。当我从VM模块中删除VM创建时,除了VM之外,所有东西都被创建了。所有资源都在同一个资源组中。有什么想法吗?
完整的文件在这里(有点不同,因为我尝试了一些其他的东西,看看他们是否会工作)https://github.com/TimChermin/azure-bicep
resource nic_name 'Microsoft.Network/networkInterfaces@2021-02-01' = {
name: nic.name
location: location
tags: {
vendor: tags.vendor
description: tags.description
}
properties: {
ipConfigurations: [
{
name: nic.ipConfigName
properties: {
privateIPAllocationMethod: 'Dynamic'
publicIPAddress: {
id: publicIPAddressName.id
}
subnet: {
id: '${vnetNameId}/subnets/${subnetName}'
}
}
}
]
}
dependsOn: [
]
}
resource vm 'Microsoft.Compute/virtualMachines@2021-04-01' = {
name: vmName
location: location
tags: {
vendor: tags.vendor
description: tags.description
}
properties: {
hardwareProfile: {
vmSize: vmSize
}
osProfile: {
computerName: vmName
adminUsername: vmAdminUsername
adminPassword: vmAdminPassword
}
storageProfile: {
imageReference: {
publisher: 'MicrosoftWindowsServer'
offer: 'WindowsServer'
sku: '2016-Datacenter'
version: 'latest'
}
osDisk: {
createOption: 'FromImage'
caching: 'ReadWrite'
managedDisk: {
storageAccountType: 'Standard_LRS'
}
}
}
networkProfile: {
networkInterfaces: [
{
id: nic_name.id
}
]
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
storageUri: diagnostics_storageAccount_name.properties.primaryEndpoints.blob
}
}
}
dependsOn: [
diagnostics_storageAccount_name
]
}
叫成这样
module networkModule 'modules/networkmodule.bicep' = {
name: 'NetworkModule'
params: {
vnetName: vnet.name
subnetName: vnet.subnet.name
vnetAddress: vnet.addressPrefix
subnetAddress: vnet.subnet.addressPrefix
}
}
module vmModuleOne 'modules/testing.bicep' = {
name: 'vmModuleOne'
params: {
vmAdminUsername: vmAdminUsername
vmAdminPassword: vmAdminPassword
vmDnsName: vmDnsName
vmSize: vmSize
vnetNameId: networkModule.outputs.vnetId
subnetName: vnet.subnet.name
diagnostics: diagnosticsOne
vmName: vmName
nameSpace: nameSpaceOne
}
dependsOn:[
networkModule
]
}
module vmModuleTwo 'modules/testing.bicep' = {
name: 'vmModuleTwo'
params: {
vmAdminUsername: vmAdminUsername
vmAdminPassword: vmAdminPassword
vmDnsName: vmDnsNameTwo
vmSize: vmSize
vnetNameId: networkModule.outputs.vnetId
subnetName: vnet.subnet.name
diagnostics: diagnosticsTwo
vmName: vmNameTwo
nameSpace: nameSpaceTwo
}
dependsOn:[
networkModule
vmModuleOne
]
}
2条答案
按热度按时间toe950271#
需要在下面检查:
"dependsOn"
属性将用于指定资源依赖项。请验证是否正确给出了依赖项。有关任何其他部署错误,请参阅this。
我在github中使用了您提供的相同代码。我收到了一些与
dns
名称相关的错误。但后来,它在我的环境中只对用户信息进行了微小的更改,并成功部署了所有给定的资源。Dns
已存在于其他位置。修改后部署成功,如图所示:
入口:
yrdbyhpb2#
所以我在Octopus配置中犯了一个错误。我使用Runbook来部署ARM模板。问题是我的变量没有被使用,因为我给它们分配了角色。Runbook中没有使用这些角色。