# 指定订阅名称
$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. Java8 Stream API

    Stream是Java8中,操作集合的一个重要特性. 从iteration到Stream操作 当你操作一个集合的时候,你通常的做法是迭代每一个元素,然后处理你想要的事情.举个例子: String co ...

  2. linux 打开远程samba服务器

    sudo mount -t cifs //10.104.*.*data /home/leeyoung/samba/ -o username=123,password=123

  3. ubuntu网站做图像外链

    http://paste.ubuntu.org.cn

  4. CodeForce---Educational Codeforces Round 3 USB Flash Drives (水题)解题报告

    对于这题明显是用贪心算法来解决问题: 下面贴出笔者的代码: #include<cstdio> #include<iostream> #include<algorithm& ...

  5. python学习之copy模块

    Python中的对象之间赋值时是按引用传递的,如果需要拷贝对象,需要使用标准库中的copy模块. 1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象.2. copy.deepc ...

  6. 转载:MATLAB画图常用调整代码

    %单y轴 plot(t*1e+,abs(iGG)/max(abs(iGG)),); axis([-,,,]) xlabel('时间/ns'); ylabel('幅度/a.u.'); ,'FontNam ...

  7. 《GettingThingsDone》--GTD学习笔记(一)-GTD理论

    利用春节假期阅读了<Getting Things Done>一书,下文整理了下阅读过程中做的读书笔记和心得. ==GTD理论== 一. 目的: 1. 收集需要处理的事情把它置于一个脱离大脑 ...

  8. javascript设计模式8

    桥接模式(将抽象与其实现隔离开来,以便二者独立变化) function sendInfo(element){ var id=element.id; ajax("GET"," ...

  9. 字符串旋转(str.find()---KMP)

    此题旋转带有技巧性,问题转化为常见的问题,熟练STL可以直接用str.find()函数,其是主要想用KMP算法实现字符串的查找算法... //如果对于一个字符串A,将A的前面任意一部分挪到后边去形成的 ...

  10. MyEclipse整合Git

    1. 在OSC@China申请账号,建立项目 2. MyEclipse中选择导入项目-->Git-->Projects from Git 3. 填入Git的地址.User Name和Pas ...