Azure ARM (22) 使用Azure PowerShell创建Azure RM VM
《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的更多相关文章
- [New Portal]Windows Azure Virtual Machine (16) 使用Azure PowerShell创建Azure Virtual Machine
<Windows Azure Platform 系列文章目录> 注:本章内容和之前的[New Portal]Windows Azure Virtual Machine (12) 在本地制作 ...
- 使用 PowerShell 创建 Azure VM 的自定义映像
自定义映像类似于应用商店映像,不同的是自定义映像的创建者是你自己. 自定义映像可用于启动配置,例如预加载应用程序.应用程序配置和其他 OS 配置. 在本教程中,你将创建自己的 Azure 虚拟机自定义 ...
- Azure ARM (22) Azure Policy入门
<Windows Azure Platform 系列文章目录> 我们知道,在Azure服务层级中,分为以下几个层次: 1.企业合同 2.订阅 3.资源组 4.资源 我们使用的Azure资源 ...
- Azure机器学习入门(二)创建Azure机器学习工作区
我们将开始深入了解如何使用Azure机器学习的基本功能,帮助您开始迈向Azure机器学习的数据科学家之路. Azure ML Studio (Azure Machine Learning Studio ...
- Azure机器学习入门(三)创建Azure机器学习实验
在此动手实践中,我们将在Azure机器学习Studio中一步步地开发预测分析模型,首先我们从UCI机器学习库的链接下载普查收入数据集的样本并开始动手实践: http://archive.ics.uci ...
- 使用PowerShell创建Azure Storage的SAS Token访问Azure Blob文件
Azure的存储包含Storage Account.Container.Blob等具体的关系如下: 我们常用的blob存储,存放在Storage Account的Container里面. 目前有三种方 ...
- Azure ARM (10) ARM模式下的虚拟机和Classic Model虚拟机的区别
<Windows Azure Platform 系列文章目录> 本文内容比较多,请大家仔细阅读,谢谢! 请读者注意,在Azure ARM平台,有两种虚拟机模式:经典虚拟机和ARM虚拟机 A ...
- 在Azure China用自定义镜像创建Azure VM Scale Set
在Azure China用自定义镜像创建Azure VM Scale Set 在此感谢世纪互联的工程师Johnny Lee和Lan,你们给了我很大的帮助.因为Azure China的官网没有给出完整的 ...
- Azure ARM (16) 基于角色的访问控制 (Role Based Access Control, RBAC) - 使用默认的Role
<Windows Azure Platform 系列文章目录> 今天上午刚刚和客户沟通过,趁热打铁写一篇Blog. 熟悉Microsoft Azure平台的读者都知道,在老的Classic ...
随机推荐
- Ubuntu 12.04不能在華碩F81se系列電腦上安裝解决辦法
本人華碩F81se系列的電腦,剛開始是裝的ubuntu 10.04的系統,周末閑的無聊,就想把系統換成ubuntu 12.04的,從ubuntu官網上下載了12.04的安裝包,下了個usb insta ...
- ARM Linux中断发生时内核堆栈切换
转载注明出处:http://www.wowotech.net/forum/viewtopic.php?id=54 对ARM Linux中断非常简洁.精确的描述. 发生了中断,最重要的是保存现场,在中断 ...
- vmware安装centos问题
* 选择安装后,一直黑屏 重新启动电脑,在启动界面进入BIOS设置,找到Intel (R) Virtualization Technology,设置成Enabled,保存设置以后重新启动电脑,问题解决 ...
- urllib.request中Handler处理器
1.定义 自定义的urlopen()方法,urlopen()方法是一个特殊的opener(模块已定义好),不支持代理等功能,通过Handler处理器对象来自定义opener对象 2.常用方法 1.bu ...
- [LeetCode&Python] Problem 860. Lemonade Change
At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...
- s21day05 python笔记
s21day05 python笔记 一.昨日内容回顾及补充 回顾 补充 列表独有功能 extend:循环添加到一个列表中 1.users = ['张三',66],people = ['王五',99] ...
- 代码规范V1.1
作业要求:[https://edu.cnblogs.com/campus/nenu/SWE2017FALL/homework/993] 代码规范文档/代码规范执行记录:[https://coding. ...
- 快速排序 C语言实现
转载于> http://blog.chinaunix.net/uid-26404477-id-3329885.html 总的关键字比较次数:O(nlgn) 尽管快速排序的最坏时间为O(n2),但 ...
- 【BZOJ1030】【JSOI2007】文本生成器
我现在连AC自动姬都不会,怎么办嘛QAQ 原题: JSOI交给队员ZYX一个任务,编制一个称之为“文本生成器”的电脑软件:该软件的使用者是一些低幼人群,他们现在使用的是GW文本生成器v6版.该软件可以 ...
- Spring boot Mybatis 整合
PS: 参考博客 PS: spring boot配置mybatis和事务管理 PS: Spring boot Mybatis 整合(完整版) 这篇博客里用到了怎样 生成 mybatis 插件来写程 ...