通过API具有IP地址的Azure VM [英] Azure VM with IP address through API
问题描述
你好-如何使用通过API的请求使用公共IP地址创建Azure VM.这是当前的请求正文,但我不知道我需要添加什么才能使VM具有公共IP地址. -谢谢
{
位置":"ukwest",
属性":{
"hardwareProfile":{
"vmSize":"Standard_B1s"
},
"storageProfile":{
"imageReference":{
"id":"/subscriptions/28f23ba2-c344-448c-808b-e45a97a29764/resourceGroups/main/providers/Microsoft.Compute/images/ukproxy"
},
"osDisk":{
缓存":"ReadWrite",
"managedDisk":{
"storageAccountType":"Standard_LRS"
},
名称":"myVMosdisk",
" createOption":"FromImage"
}
},
"osProfile":{
"adminUsername":"user",
" computerName":"用户" ;,
" adminPassword":"password!"
},
" networkProfile":{
"networkInterfaces":[
{
"id":"/subscriptions/28f23ba2-c344-448c-808b-e45a97a29764/resourceGroups/main/providers/Microsoft.Network/networkInterfaces/nic",
属性":{
"primary":true
}
}
]
}
},
"名称":"VM"
}
Hello - how do I create a Azure VM with a public IP address using requests through there API. This is the current request body but I dont know what I need to add to have the VM have an public IP address - Thanks
{
"location": "ukwest",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_B1s"
},
"storageProfile": {
"imageReference": {
"id": "/subscriptions/28f23ba2-c344-448c-808b-e45a97a29764/resourceGroups/main/providers/Microsoft.Compute/images/ukproxy"
},
"osDisk": {
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"name": "myVMosdisk",
"createOption": "FromImage"
}
},
"osProfile": {
"adminUsername": "user",
"computerName": "user",
"adminPassword": "password!"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/28f23ba2-c344-448c-808b-e45a97a29764/resourceGroups/main/providers/Microsoft.Network/networkInterfaces/nic",
"properties": {
"primary": true
}
}
]
}
},
"name": "VM"
}
推荐答案
您好,SneakerSpace,
Hi SneakerSpace,
我看到您已经创建了一个名为"nic"的网络接口.
查看示例
在此处创建带有公共IP地址的网络接口.在这里,我们指的是我们已经创建的公共IP地址.
I see that you have created a network interface called 'nic'.
Look at the example
here which creates a network interface with public ip address. Here we are referring to the public ip address which we created already.
创建公共IP的示例为 这里.在这里,公共ip地址是使用默认值创建的.您可以浏览api文档中的所有选项.
Example to create a public ip is here. Here public ip address is created with default values. You can go through the api document for all the options.
如果要使用的编程语言有可用的SDK,也可以考虑使用SDK.
Also consider using SDK's if a SDK is available for the programming language which you are using.
尝试一下,让我知道.
这篇关于通过API具有IP地址的Azure VM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!