使用 Azure REST API 创建 NetworkInterface 导致 InvalidRequestFormat 没有详细信息
Creating NetworkInterface in with Azure REST API results in InvalidRequestFormat without details
我正在尝试 create a NetworkInterface
请求正文如下所示:
{
"location": "North Europe",
"properties": {
"ipConfigurations": [
{
"properties": {
"privateIPAddress": "10.10.1.4",
"subnet": {
"id": "/subscriptions/<foo>/resourceGroups/<bar>/providers/Microsoft.Network/virtualNetworks/<funk>/subnets/<blah>"
}
}
}
],
"networkSecurityGroup": {
"id": "/subscriptions/<foo>/resourceGroups/<bar>/providers/Microsoft.Network/networkSecurityGroups/<baz>"
}
}
}
但是,这会导致错误:
{
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": []
}
}
这尤其令人惊讶,因为错误消息通常包含有用的详细信息。
关于我在这里可能出错的地方有什么建议吗?
这是我这边的工作示例。经过我的验证,我们必须在"ipConfigurations"
下指定"name": "ipconfig1"
。如果你不指定"privateIPAllocationMethod": "Static"
,它会为你动态分配IP地址。
{
"location": "westus2",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "172.29.0.4",
"privateIPAllocationMethod": "Static",
"subnet": {
"id": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/virtualNetworks/vnet/subnets/<default>"
}
}
}
],
"networkSecurityGroup": {
"id": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/networkSecurityGroups/<nsg>"
}
}
}
结果
我正在尝试 create a NetworkInterface
请求正文如下所示:
{
"location": "North Europe",
"properties": {
"ipConfigurations": [
{
"properties": {
"privateIPAddress": "10.10.1.4",
"subnet": {
"id": "/subscriptions/<foo>/resourceGroups/<bar>/providers/Microsoft.Network/virtualNetworks/<funk>/subnets/<blah>"
}
}
}
],
"networkSecurityGroup": {
"id": "/subscriptions/<foo>/resourceGroups/<bar>/providers/Microsoft.Network/networkSecurityGroups/<baz>"
}
}
}
但是,这会导致错误:
{
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": []
}
}
这尤其令人惊讶,因为错误消息通常包含有用的详细信息。
关于我在这里可能出错的地方有什么建议吗?
这是我这边的工作示例。经过我的验证,我们必须在"ipConfigurations"
下指定"name": "ipconfig1"
。如果你不指定"privateIPAllocationMethod": "Static"
,它会为你动态分配IP地址。
{
"location": "westus2",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "172.29.0.4",
"privateIPAllocationMethod": "Static",
"subnet": {
"id": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/virtualNetworks/vnet/subnets/<default>"
}
}
}
],
"networkSecurityGroup": {
"id": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/networkSecurityGroups/<nsg>"
}
}
}
结果