繁体   English   中英

使用Java SDK使用临时OS磁盘创建Azure虚拟机

[英]Create Azure Virtual Machine with ephemeral OS disk using Java SDK

根据Azure 文档 ,可以为Azure VM使用临时操作系统磁盘。

我需要带有短暂操作系统磁盘的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}]

希望能帮助到你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM