历史上的今天
今天是:2024年12月16日(星期一)
2019年12月16日 | Azure ARM (22) 使用Azure PowerShell创建Azure RM VM
2019-12-16 来源:eefocus
在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.20170411
在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 22
$nsgRuleSSH = New-AzureRmNetworkSecurityRuleConfig -Name default-allow-ssh -Protocol Tcp `
-Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * `
-DestinationPortRange 22 -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[0].Id -NetworkSecurityGroupId $nsg.Id
#新建可用性组
$avbSetName = "My-AvbSet"
$availabilitySet = New-AzureRmAvailabilitySet -ResourceGroupName $resourceGroupName -Name $avbSetName -Location $locationName
#1.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)
#2.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
#3.Choose source image
$VM = Set-AzureRmVMSourceImage -VM $VM -publisherName 'OpenLogic' -sku '6.9' -Offer CentOS -Version 6.9.20170411
#4.Add the network interface to the configuration
$VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $networkInterface.id
#5.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
#6. Create a virtual machine
New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $LocationName -VM $VM -ErrorAction Stop
Write-Host "Successfully created a virtual machine $VMName" -ForegroundColor Green
史海拾趣
|
每天晚上8点到10点之间,你在做什么基本决定着你是薪水见涨,还是薪水见降。 8点到10点之间,是在有目的性阅读,还是为明天的事情做准备,甚至在充电专业或研习第二专长?不管是哪一样,都有可能迈向成功,一个非常了解自己需要,同时也懂得 ...… 查看全部问答> |
|
将RVDS中的工程移植到RealView MDK说明文档 请点击链接:http://arm.embedinfo.com/BBS/dispbbs.asp?boardid=3&Id=219… 查看全部问答> |
|
盲区补偿主要就是在GPS信号不好的时候为系统提供如下参考信息作为补偿:方向、(到达兴趣点的)距离。方向由电子罗盘提供,距离由加速度传感器提供(加速度积分得到速度,速度积分得到距离)。   ...… 查看全部问答> |
|
本帖最后由 paulhyde 于 2014-9-15 03:51 编辑 这是《大学生智能汽车设计》整本书的课件,内容很全面,希望对大家有所帮助~~~以下是目录 第1章 智能汽车设计导论 1.1 智能汽车 1.1.1 智能汽车设计的意义及研究内容 1.1.2 智能汽车设计的技术关 ...… 查看全部问答> |
|
Crossing clock domains - Signal A signal to another clock domain Let\'s say a signal from clkA domain is needed in clkB domain. It needs to be \"synchronized\" to clkB domain, so we want to build a \"synchronizer\" design, which takes a signal from clkA domain, ...… 查看全部问答> |
|
NAND ID is 0xecf1 Memory Test(30200000h-33ff0000h):O.K. Load Wince Kernel... run 0x3022bee0... Windows CE Kernel for ARM (Thumb Enabled) Built on Jun 24 2004 at 18:25:00 ProcessorType=0920 Revision=0 sp_abt=ffff5 ...… 查看全部问答> |
|
送给关注WinCE社区的每个人:提问的智慧 - How To Ask Questions The Smart Way 在各种技术社区,论坛和邮件组,用户和开发者们总是期望着自己能够获得帮助。在本文之前,曾经有过一些经典的文章,比如由Eric S. Raymond 和Rick Moen 撰写的How to Ask Questions the Smart Way --- 我得承认我盗用了这个文章的标题: ...… 查看全部问答> |
|
Wince6.0 + Micro2440 + Max17040/17041 需要进行电量检测。 在2440的BSP中不是已经有了IIC的驱动了吗,还需要做些什么啊?从来没有接触过,实在不知道怎么下手,请各路高手指个方向。… 查看全部问答> |




