# 指定订阅名称
$subscriptionName=“订阅名称"
# 指定云服务名称
$serviceName="云服务名称"
# 指定用来保存虚拟机VHD的存储
$storageAccount=“存储账号"
# 指定网络名称
$vnetName=“虚拟网络名称"
# 指定虚拟网络
$subnetNames="SubNetwork01"
# 指定虚拟机名称
$name=“虚拟机名称"
# 指定有效性集
$availabilitysetName=“有效性集"
# 指定虚拟机大小
$instanceSize="Large"
# 指定镜像名称
$imageName="f1179221e23b4dbb89e39d70e5bc9e72__OpenLogic-CentOS-72-20160617"
# 指定Linux管理员名称
$linuxUser=“管理员名称"
# 指定Windows管理员名称
$adminssername=“管理员名称"
# 指定密码
$password="密码"
# 指定时区
$timeZone="China Standard Time"

# 登录资源
# Login-AzureRmAccount -EnvironmentName "AzureChinaCloud"
# Select-AzureRmSubscription -SubscriptionName $subscriptionName

# Add-AzureAccount -Environment AzureChinaCloud
# Select-AzureSubscription -SubscriptionName $subscriptionName

# 获取订阅
# Get-AzureSubscription | where {$_.SubscriptionName -eq $subscriptionName} | select SubscriptionName, IsCurrent | Format-Table -AutoSize
# 获取云服务
# Get-AzureService -ServiceName $serviceName | select Location, Status | Format-Table -AutoSize
# 获取存储账号
# Get-AzureStorageAccount | where {$_.StorageAccountName -eq $storageAccount} | select StorageAccountName, StorageAccountStatus, StatusOfPrimary| Format-Table -AutoSize
# 获取网络设置
# Get-AzureVNetSite -VNetName $vnetName | select Subnets | Format-Table -AutoSize

# 获取镜像名称
# Get-AzureVMImage | where {$_.ImageName -like "*CentOS-72*"} | SELECT ImageName | Format-Table -AutoSize
# 55bc2b193643443bb879a78bda516fc8__Windows-Server-2012-R2-20160721-zh.cn-127GB.vhd
# f1179221e23b4dbb89e39d70e5bc9e72__OpenLogic-CentOS-72-20160617
# Get-AzureVMImage | where {$_.ImageName -like "*Windows-Server-2012-R2*" -and $_.ImageName -like "*zh.cn*"} | SELECT ImageName | Format-Table -AutoSize

# 设定当前订阅的存储账号
Select-AzureSubscription -SubscriptionName $subscriptionName
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccountName $storageAccount

# New-AzureVMConfig -Name $name -InstanceSize $instanceSize -AvailabilitySetName $availabilitysetName -ImageName $imageName | Add-AzureProvisioningConfig -Windows -AdminUsername $adminssername -Password $password -DisableAutomaticUpdates -TimeZone $timeZone | Set-AzureSubnet -SubnetNames $subnetNames | New-AzureVM -ServiceName $serviceName -VNetName $vnetName

New-AzureVMConfig -Name $name -InstanceSize $instanceSize -AvailabilitySetName $availabilitysetName -ImageName $imageName | Add-AzureProvisioningConfig –Linux -LinuxUser $linuxUser -Password $password | Set-AzureSubnet -SubnetNames $subnetNames | New-AzureVM -ServiceName $serviceName -VNetName $vnetName

Azure PowerShell 创建虚拟机的更多相关文章

  1. Azure China (8) 使用Azure PowerShell创建虚拟机,并设置固定Virtual IP Address和Private IP

    <Windows Azure Platform 系列文章目录> 本文介绍的是由世纪互联运维的Windows Azure China. 相比于Global Azure (http://www ...

  2. Azure PowerShell (5) 使用Azure PowerShell创建简单的Azure虚拟机和Linux虚拟机

    <Windows Azure Platform 系列文章目录> 本文介绍的是国外的Azure Global.如果是国内由世纪互联运维的Azure China,请参考这篇文档: Azure ...

  3. Azure 基础:使用 powershell 创建虚拟机

    在进行与 azure 相关的自动化过程中,创建虚拟主机是避不开的操作.由于系统本身的复杂性,很难用一两条简单的命令完成虚拟主机的创建.所以专门写一篇文章来记录使用 PowerShell 在 azure ...

  4. Azure PowerShell (12) 通过Azure PowerShell创建SSH登录的Linux VM

    <Windows Azure Platform 系列文章目录> 本章将介绍如何使用Azure PowerShell,创建SSH登录的Linux VM 前提要求: 1.安装Azure Pow ...

  5. Windows 上安装 Azure PowerShell及Azure PowerShell部署虚拟机

    一.Azure PowerShell部署   1.使用 PowerShellGet 在 Windows 上安装 Azure PowerShell 从 Azure PowerShell 版本 6.0 开 ...

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

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

  7. Azure ARM (22) 使用Azure PowerShell创建Azure RM VM

    <Windows Azure Platform 系列文章目录> 在Azure China获得VM Image,可以执行下面的脚本. Get-AzureRmVMImagePublisher ...

  8. 使用 Azure CLI 创建虚拟机

    使用 az vm create 命令创建虚拟机. 创建虚拟机时,可使用多个选项,例如操作系统映像.磁盘大小调整和管理凭据. 在此示例中,创建了一个名为“myVM”的运行 Ubuntu Server 的 ...

  9. Azure Powershell 创建 Internal Load Balancer

    Select-AzureSubscription -SubscriptionName "订阅名称" $serviceName="云服务名称" $ilbName= ...

随机推荐

  1. EF5.0修改实体的时候,出现“对一个或多个实体的验证失败。有关详细信息,请参见“EntityValidationErrors”属性这个错误

    对于这个错误,要在SaveChanges前关闭验证实体有效性(ValidateOnSaveEnabled)这个开关 db.Configuration.ValidateOnSaveEnabled = f ...

  2. jquery选择器返回值

    jquery选择器$('selector')返回的不是数组,而是封装好的jquery对象.但这个对象有一个特别的地方,就是查询到的节点被以下标为属性,添加到了jquery对象上,所以它看起来像数组,因 ...

  3. 开启sa账户以及如何用JDBC进行连接

    做实验需要用Java与SQL Server连接,因为使用的 SQL 2008 Express Edition 是基于 Visual Studio2010 安装包安装时一起安装的,所以为了方便数据库的操 ...

  4. dataStructure@ Binary Search Tree

    #include<iostream> #include<cstdio> #include<cstring> #include<limits> #incl ...

  5. Eclipse hangs on loading workbench, eclipse停在启动界面的处理办法

    http://stackoverflow.com/questions/8972034/eclipse-hangs-on-loading-workbench 解答一: In most cases, rm ...

  6. C 头文件阅读理解

    __BEGIN_DECLS ..... ..... __END_DECLS 很多时候,为了使 C 代码和 C++ 代码保持互相兼容的过程调用接口,需要在 C++ 代码里加上 extern " ...

  7. FreeModbus Slave RTU 精简版源代码【worldsing 笔记】

    RTU精简版本 测试环境:IAR for avr 5.40 + M128 目前只优化了ModBusPort.c和ModBusRTU.c ModBusPort.c     566 bytes of CO ...

  8. 浅析作用域链–JS基础核心之一

    JS中的作用域,大家都知道的,分为全局作用域和局部作用域,没有块级作用域,听起来其实很简单的,可是作用域是否能够有深入的了解,对于JS代码逻辑的编写成功率,BUG的解决能力,以及是否能写出更优秀的代码 ...

  9. C#实现异步编程的两个简单机制(异步委托&定时器)及Thread实现多线程

    创建线程的常用方法:异步委托.定时器.Thread类 理解程序.进程.线程三者之间的区别:简而言之,一个程序至少有一个进程,一个进程至少有一个线程进程就是在内存中运行的程序(即运行着的程序):一个进程 ...

  10. IEnumerable、IEnumerator与yield的学习

    我们知道数组对象可以使用foreach迭代进行遍历,同时我们发现类ArrayList和List也可以使用foreach进行迭代.如果我们自己编写的类也需要使用foreach进行迭代时该怎么办呢? IE ...