《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. 10.2.0.5环境dg测试logminer挖掘日志分析

    起因:客户需求,数据库正常每天总的日志切换是20以内,有一天日志切换总数,达到30,客户建议使用Logminer进行日志挖掘分析,到底什么应用导致的问题. 说明:使用logminer进行日志挖掘,只能 ...

  2. ss linux终端配置

    最近ss莫名宕机,懒得重新安装了,就安装了一个非gui版本,安装非gui版本还有一个优点就是在远程服务器的时候可以用proxychains进行终端代理,非常友好实用.下面简单的说一下如何进行终端ss ...

  3. 九度OJ1020-最小正方形-判大小

    题目1020:最小长方形 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7410 解决:3521 题目描述:     给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个 ...

  4. directive例子2

    (function() { angular.module('app.widgets') .directive('bsModalPlus', function($window, $sce, $modal ...

  5. (3)diango的架构

    MVC架构:主流的web都是MVC架构 M 就是模型层指得是model,对应的就是数据库操作层 V 就是视图,和MTV架构的视图层不是一个概念,对应MTV架构中的T C 控制器,根据请求地址执行什么代 ...

  6. 《DSP using MATLAB》Problem 5.19

    代码: function [X1k, X2k] = real2dft(x1, x2, N) %% --------------------------------------------------- ...

  7. 小白python 安装

    小白python 安装: https://blog.csdn.net/qq_36667170/article/details/79275605 https://blog.csdn.net/nmjuzi ...

  8. shell-dict-uniq-count

    shell dict  #!/bin/bash result_file="a" declare -A mydict :>${result_file} total=`cat $ ...

  9. 统计cpu相关信息

    我的cpu为i3310m 适用类型:笔记本 CPU系列:酷睿i3 3代系列 CPU主频:2.4GHz 三级缓存:3MB 插槽类型:FCBGA1023,FCPGA988 封装大小:37.5×37.5mm ...

  10. 使用btrace需要注意的几个问题

    1. @ProbeClassName String clazz 此处String不能写为java.lang.String 2. location=@Location(Kind.RETURN) publ ...