java - 使用 Java SDK 创建具有临时 OS 磁盘的 Azure 虚拟机
问题描述
根据 Azure文档,可以为 Azure VM 使用临时 OS 磁盘。
我需要带有临时 OS 磁盘的 CentOS VM。
但是,我找不到任何关于如何使用 Java SDK 创建 VM 的示例。
是否可以使用 Java SDK?
解决方案
Alex,不太确定 Java sdk,但您可以使用 ARM 模板或 Azure cli 创建带有临时 OS 磁盘的 VM。
以下是通过 ARM 的示例:
{
"type": "Microsoft.Compute/virtualMachines",
"name": "myVirtualMachine",
"location": "East US 2",
"apiVersion": "2018-06-01",
"properties": {
"storageProfile": {
"osDisk": {
"diffDiskSettings": {
"option": "Local"
},
"caching": "ReadOnly",
"createOption": "FromImage"
},
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-smalldisk",
"version": "latest"
},
"hardwareProfile": {
"vmSize": "Standard_DS2_v2"
}
},
"osProfile": {
"computerNamePrefix": "myvirtualmachine",
"adminUsername": "azureuser",
"adminPassword": "P@ssw0rd!"
}
}
}
通过 CLI
az vm create --name
--resource-group
[--accelerated-networking {false, true}]
[--admin-password]
[--admin-username]
[--asgs]
[--assign-identity]
[--attach-data-disks]
[--attach-os-disk]
[--authentication-type {all, password, ssh}]
[--availability-set]
[--boot-diagnostics-storage]
[--computer-name]
[--custom-data]
[--data-disk-caching]
[--data-disk-sizes-gb]
[--ephemeral-os-disk {false, true}]
[--generate-ssh-keys]
[--image]
[--license-type {None, Windows_Client, Windows_Server}]
[--location]
[--nics]
[--no-wait]
[--nsg]
[--nsg-rule {RDP, SSH}]
[--os-disk-caching {None, ReadOnly, ReadWrite}]
[--os-disk-name]
[--os-disk-size-gb]
[--os-type {linux, windows}]
[--plan-name]
[--plan-product]
[--plan-promotion-code]
[--plan-publisher]
[--ppg]
[--private-ip-address]
[--public-ip-address]
[--public-ip-address-allocation {dynamic, static}]
[--public-ip-address-dns-name]
[--public-ip-sku {Basic, Standard}]
[--role]
[--scope]
[--secrets]
[--size]
[--ssh-dest-key-path]
[--ssh-key-values]
[--storage-account]
[--storage-container-name]
[--storage-sku]
[--subnet]
[--subnet-address-prefix]
[--subscription]
[--tags]
[--ultra-ssd-enabled {false, true}]
[--use-unmanaged-disk]
[--validate]
[--vnet-address-prefix]
[--vnet-name]
[--zone {1, 2, 3}]
希望能帮助到你。
推荐阅读
- oracle - Oracle 中等效的 SQL_NO_CACHE 命令
- unity3d - 启动游戏时的小窗口(Unity)
- r - RShiny:为什么 ggplot geom_rect 因反应刻面而失败?
- java - 尝试在成功时调用 Api 将获取数据,但在失败时会关闭对话框并显示空白 Plage
- camera-calibration - Webot 相机默认参数,如像素大小和焦点
- bash - curl -C, --continue-at 管道标准输出时是否工作?
- javascript - 在本机反应中无法访问从切换发送的道具
- python-3.x - IndentationError: unindent 不匹配任何外部缩进级别...这是为什么呢?
- sql - STRING_SPLIT 以逗号分隔到不同的表
- laravel - 使用同一张卡进行订阅和一次性付款时出错