《Windows Azure Platform 系列文章目录

  在Azure China获得VM Image,可以执行下面的脚本。

Get-AzureRmVMImagePublisher -Location chinaeast

Get-AzureRmVMImageOffer -Location chinaeast -PublisherName 'OpenLogic' 

Get-AzureRmVMImagesku -Location chinaeast -PublisherName 'OpenLogic' -Offer CentOS

Get-AzureRMVMImage -location chinaeast -publisherName 'OpenLogic' -sku '6.9' -Offer CentOS

Get-AzureRMVMImage -location chinaeast -publisherName 'OpenLogic' -sku '6.9' -Offer CentOS -Version 6.9.

  在Azure China创建Linux VM,可以执行下面的脚本。

Login-AzureRmAccount -Environment AzureChinaCloud

#这里设置订阅名称
$subscriptionName = '订阅名称' Select-AzureRmSubscription -SubscriptionName $subscriptionName #需要手动创建虚拟网络
$resourceGroupName = "这里设置资源组"
$virtualNetworkName = "这里设置虚拟网络" $locationName = "China East"
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName #自动创建blob
#$BlobURL = New-AzureRmStorageAccount -Location $locationName -ResourceGroupName $resourceGroupName -Name testvmshstorage -SkuName "Standard_LRS"
$BlobURL = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name testvmshstorage #新建network interface
#$publicIPAddress = "MyNewPIP"
#$publicIp = New-AzureRmPublicIpAddress -Name $publicIPAddress -ResourceGroupName $ResourceGroupName -Location $locationName -AllocationMethod Dynamic #虚拟机名称
$vmName = "这里设置虚拟机名称"
$vmSize = "Standard_D3_V2" #新建Network Security Group:
# Create an inbound network security group rule for port
$nsgRuleSSH = New-AzureRmNetworkSecurityRuleConfig -Name default-allow-ssh -Protocol Tcp `
-Direction Inbound -Priority -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * `
-DestinationPortRange -Access Allow $nsgName = $vmName + "-nsg" # Create a network security group
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroupName -Location $locationName -Name $nsgName -SecurityRules $nsgRuleSSH #虚拟机创建虚拟网络的第一个子网里
$nicName = $vmName + "-nic"
$networkInterface = New-AzureRmNetworkInterface -ResourceGroupName $resourceGroupName -Name $nicName -Location $locationName -SubnetId $virtualNetwork.Subnets[].Id -NetworkSecurityGroupId $nsg.Id #新建可用性组
$avbSetName = "My-AvbSet"
$availabilitySet = New-AzureRmAvailabilitySet -ResourceGroupName $resourceGroupName -Name $avbSetName -Location $locationName #.Set the administrator account name and password for the virtual machine.
$username = "Linux用户名";
$password = 'Linux密码';
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($UserName, $securePassword) #.Choose virtual machine size, set computername and credential
$VM= New-AzureRmVMConfig -VMName $vmName -VMSize $vmSize -AvailabilitySetID $availabilitySet.Id -ErrorAction Stop
$VM = Set-AzureRmVMOperatingSystem -VM $VM -Linux -ComputerName $vmName -Credential $cred -ErrorAction Stop #.Choose source image
$VM = Set-AzureRmVMSourceImage -VM $VM -publisherName 'OpenLogic' -sku '6.9' -Offer CentOS -Version 6.9. #.Add the network interface to the configuration
$VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $networkInterface.id #.Add storage that the virtual hard disk will use.
$BlobPath = "vhds/"+ $vmName +"-OSDisk.vhd"
$OSDiskUri = $BlobURL.PrimaryEndpoints.Blob + $BlobPath
$DiskName = "linuxvmosdisk"
$VM = Set-AzureRmVMOSDisk -VM $VM -Name $DiskName -VhdUri $OSDiskUri -CreateOption fromImage -ErrorAction Stop #. Create a virtual machine
New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $LocationName -VM $VM -ErrorAction Stop
Write-Host "Successfully created a virtual machine $VMName" -ForegroundColor Green

  

Azure ARM (22) 使用Azure PowerShell创建Azure RM VM的更多相关文章

  1. [New Portal]Windows Azure Virtual Machine (16) 使用Azure PowerShell创建Azure Virtual Machine

    <Windows Azure Platform 系列文章目录> 注:本章内容和之前的[New Portal]Windows Azure Virtual Machine (12) 在本地制作 ...

  2. 使用 PowerShell 创建 Azure VM 的自定义映像

    自定义映像类似于应用商店映像,不同的是自定义映像的创建者是你自己. 自定义映像可用于启动配置,例如预加载应用程序.应用程序配置和其他 OS 配置. 在本教程中,你将创建自己的 Azure 虚拟机自定义 ...

  3. Azure ARM (22) Azure Policy入门

    <Windows Azure Platform 系列文章目录> 我们知道,在Azure服务层级中,分为以下几个层次: 1.企业合同 2.订阅 3.资源组 4.资源 我们使用的Azure资源 ...

  4. Azure机器学习入门(二)创建Azure机器学习工作区

    我们将开始深入了解如何使用Azure机器学习的基本功能,帮助您开始迈向Azure机器学习的数据科学家之路. Azure ML Studio (Azure Machine Learning Studio ...

  5. Azure机器学习入门(三)创建Azure机器学习实验

    在此动手实践中,我们将在Azure机器学习Studio中一步步地开发预测分析模型,首先我们从UCI机器学习库的链接下载普查收入数据集的样本并开始动手实践: http://archive.ics.uci ...

  6. 使用PowerShell创建Azure Storage的SAS Token访问Azure Blob文件

    Azure的存储包含Storage Account.Container.Blob等具体的关系如下: 我们常用的blob存储,存放在Storage Account的Container里面. 目前有三种方 ...

  7. Azure ARM (10) ARM模式下的虚拟机和Classic Model虚拟机的区别

    <Windows Azure Platform 系列文章目录> 本文内容比较多,请大家仔细阅读,谢谢! 请读者注意,在Azure ARM平台,有两种虚拟机模式:经典虚拟机和ARM虚拟机 A ...

  8. 在Azure China用自定义镜像创建Azure VM Scale Set

    在Azure China用自定义镜像创建Azure VM Scale Set 在此感谢世纪互联的工程师Johnny Lee和Lan,你们给了我很大的帮助.因为Azure China的官网没有给出完整的 ...

  9. Azure ARM (16) 基于角色的访问控制 (Role Based Access Control, RBAC) - 使用默认的Role

    <Windows Azure Platform 系列文章目录> 今天上午刚刚和客户沟通过,趁热打铁写一篇Blog. 熟悉Microsoft Azure平台的读者都知道,在老的Classic ...

随机推荐

  1. [转]Spark 踩坑记:数据库(Hbase+Mysql)

    https://cloud.tencent.com/developer/article/1004820 Spark 踩坑记:数据库(Hbase+Mysql) 前言 在使用Spark Streaming ...

  2. web(四)html表单类标签

    表单类标签 操作者用于输入信息,并将信息提交给服务器的标签集合. 表单标签介绍 form标签:表单元素(其余标签)标签的容器标签 input标签:用于用户信息输入的标签. button标签:按钮标签. ...

  3. 2.33 定位的坑:class属性有空格

    2.33 定位的坑:class属性有空格 前言有些class属性中间有空格,如果直接复制过来定位是会报错的InvalidSelectorException: Message:The given sel ...

  4. 从android设备中提取内核

    背景 CVE-2013-2597 是高通 msm_acdb 设备驱动的一个 copy_from_user 栈溢出,利用要用到ROP.f101的漏洞利用介绍中,用到几处Gadgets,显然要根据acdb ...

  5. JavaBasic_06

    二维数组 二维数组定义格式 格式1 数据类型 变量名 = new 数据类型m; m表示这个二维数组有多少个一维数组 n表示每一个一维数组的元素个数 格式2 灵活性 数据类型 a = new 数据类型m ...

  6. 九度OJ1111题-单词替换

    题目1111:单词替换 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6752 解决:1891 题目描述: 输入一个字符串,以回车结束(字符串长度<=100).该字符串由若干个单词组 ...

  7. [LeetCode&Python] Problem 1: Two Sum

    Problem Description: Given an array of integers, return indices of the two numbers such that they ad ...

  8. xdoj 1146 (逆向01背包)

    背包 有:01背包 逆向背包  多重背包 完全背包  所有的背包都可以根据更新的方向一维实现 amazing?! #include <iostream> #include <cstd ...

  9. 代码basic讲解

    key1 import os g = os.walk(r'D:\Users\Quincy_C\PycharmProjects\S6')print(next(g))print(next(g)) 第一次n ...

  10. 《DSP using MATLAB》Problem 5.8

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...