azure - 为网络接口 ID 创建 Azure 虚拟机 REST API 引发 404
问题描述
在与网络接口相同的资源组中创建 VM 时链接网络接口(使用https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#create_a_vm_with_password_authentication 。)会引发此问题错误(我是连接到网络接口的虚拟网络子网的所有者):
错误:
{
"error": {
"details": [],
"code": "NotFound",
"message": "Resource /subscriptions/40fbe15/resourceGroups/sym/providers/Microsoft.Network/networkInterfaces/deletethis374 not found."
}
}
请求详情:
标头:Content-Type:application/json 授权:Bearer 'eyJ0eXAimtpZCI....'(从上述 API 的 try it 功能中获得令牌)
身体:
{
'location': 'westus',
'properties': {
'hardwareProfile': {
'vmSize': 'Standard_D1_v2'
},
'storageProfile': {
'imageReference': {
'sku': '2016-Datacenter',
'publisher': 'MicrosoftWindowsServer',
'version': 'latest',
'offer': 'WindowsServer'
},
'osDisk': {
'caching': 'ReadWrite',
'managedDisk': {
'storageAccountType': 'Standard_LRS'
},
'name': 'myVMosdisk',
'createOption': 'FromImage'
}
},
'osProfile': {
"adminUsername": "Demo1",
"computerName": "myVM",
"adminPassword": "Demo1Demo1Demo1"
}
,
'networkProfile': {
'networkInterfaces': [
{
'id': '/subscriptions/40fbe15/resourceGroups/sym/providers/Microsoft.Network/networkInterfaces/deletethis374',
'properties': {
'primary': true
}
}
]
}
}
}
解决方案
在这种情况下,错误是由于 VM 及其 NIC 必须位于同一区域中。未找到错误提示,因为它正在寻找 ID 和区域的组合。
推荐阅读
- javascript - 谷歌图表 data.addRows() 可以接受数据文字吗?
- express - 已修复:预检响应错误:Access-Control-Allow-Headers 不允许使用 AWS API 网关的 Express Lambda 的 Access-control-allow-origin
- mongodb - 集群 Mongodb 4.x 多文档事务的问题
- magento - 增加 Magento 2.3.5 错误消息的图像名称的最大长度:(未上传。文件名太长;必须为 90 个字符或更少)
- mysql - 将远程 CSV 文件导入 MySQL 数据库 - 脚本
- python - riSSL:CERTIFICATE_VERIFY_FAILED 证书验证失败 (_ssl.c:852)
- python - 如果相关,我如何将变量的值组合在一起?
- c# - 请求模型与响应模型不同时的 ASP.NET Core 验证
- r - 在 MacBookAir 上使用 file.choose() 选择多个文件不起作用
- flask - 使用来自 Flask 的 Ray - init() 失败(带有核心转储)