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

一、Azure PowerShell部署

1、使用 PowerShellGet 在 Windows 上安装 Azure PowerShell

从 Azure PowerShell 版本 6.0 开始,Azure PowerShell 需要 PowerShell 版本 5.0。 若要查看在计算机上运行的 PowerShell 的版本,运行以下命令:

#$PSVersionTable.PSVersion

2、Windows PowerShell升级

https://docs.microsoft.com/zh-cn/powershell/scripting/setup/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell

//根据windows版本下载对应的powershell升级补丁

3、开始使用Azure powershell

PS C:\Users\Administrator> Install-Module -Name AzureRM
需要使用 NuGet 提供程序来继续操作
PowerShellGet 需要使用 NuGet 提供程序“2.8.5.201”或更高版本来与基于 NuGet 的存储库交互。必须在“C:\Program
Files\PackageManagement\ProviderAssemblies”或“C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAs
es”中提供 NuGet 提供程序。也可以通过运行 ‘Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force‘
NuGet 提供程序。是否要让 PowerShellGet 立即安装并导入 NuGet 提供程序?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
不受信任的存储库
你正在从不受信任的存储库安装模块。如果你信任该存储库,请通过运行 Set-PSRepository cmdlet 更改其 InstallationPolic
值。是否确实要从“PSGallery”安装模块?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
PS C:\Users\Administrator>
PS C:\Users\Administrator> Login-AzureRmAccount -EnvironmentName AzureChinaCloud     //登录中国Azure
Account          : ***@XXX.partner.onmschina.cn
SubscriptionName : Windows Azure 企业 c571e67f
SubscriptionId   : ***********************************
TenantId         : ***********************************
Environment      : AzureChinaCloud

二、虚拟机安装

1、创建资源组

PS C:\Users\Administrator> New-AzureRmResourceGroup -Name lgp2 -Location ChinaEast

ResourceGroupName : lgp2

Location          : chinaeast

ProvisioningState : Succeeded

Tags              :

ResourceId        : /subscriptions/c571e67f-785f-4dd6-8cd6-24de40a3812b/resourceGroups/lgp2

2、创建虚拟机

使用 New-AzureRmVM 创建 VM。 请提供每个资源的名称,如果这些资源不存在,New-AzureRmVM cmdlet 会创建它们。

//出现提示时,提供用作 VM 登录凭据的用户名和密码:

PS C:\Users\Administrator> New-AzureRmVm `

>>     -ResourceGroupName "lgp2" `

>>     -Name "myVM" `

>>     -Location "China East" `

>>     -VirtualNetworkName "myVnet" `

>>     -SubnetName "mySubnet" `

>>     -SecurityGroupName "myNetworkSecurityGroup" `

>>     -PublicIpAddressName "myPublicIpAddress" `

>>     -OpenPorts 80,3389

>>

//虚拟机创建成功的系统信息

ResourceGroupName        : lgp2

Id                       : /subscriptions/c571e67f-785f-4dd6-8cd6-24de40a3812b/resourceGroups/lgp2/providers/Microsoft.

Compute/virtualMachines/myVM

VmId                     : c4dd1ef3-cf2d-47f3-939b-fec3f9f27f73

Name                     : myVM

Type                     : Microsoft.Compute/virtualMachines

Location                 : chinaeast

Tags                     : {}

HardwareProfile          : {VmSize}

NetworkProfile           : {NetworkInterfaces}

OSProfile                : {ComputerName, AdminUsername, WindowsConfiguration, Secrets}

ProvisioningState        : Succeeded

StorageProfile           : {ImageReference, OsDisk, DataDisks}

FullyQualifiedDomainName : myvm-6e4097.China East.cloudapp.azure.com

PS C:\Users\Administrator> Get-AzureRmPublicIpAddress -ResourceGroupName "lgp2"|select "ipaddress"

3、远程到虚拟机

//虚拟机公网IP地址信息

IpAddress

---------

139.219.134.125

//远程到虚拟机

PS C:\Users\Administrator> mstsc /v:139.219.134.125

//虚拟机部署IIS服务

PS C:\Users\cyberadmin> Install-WindowsFeature -name Web-Server -IncludeManagementTools

Success Restart Needed Exit Code      Feature Result

------- -------------- ---------      --------------

True    No             Success        {Common HTTP Features, Default Document, D...

4、删除所有相关虚拟资源

PS C:\Users\Administrator> Remove-AzureRmResourceGroup -Name lgp2

Confirm

Are you sure you want to remove resource group ‘lgp2‘

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

True

  

原文地址:https://www.cnblogs.com/kangfeng/p/9352214.html

时间: 2024-08-07 12:17:07

Windows 上安装 Azure PowerShell及Azure PowerShell部署虚拟机的相关文章

在windows上安装ASP.NET 5(译文)

本文将介绍如何在windows上安装ASP.NET5,包括单独安装和通过Visual Studio 2015 安装. 在本文中: 通过Visual Studio安装ASP.NET 单独安装ASP.NET 通过Visual Studio安装ASP.NET 开始创建ASP.NET5应用程序的最简单的方式是安装最新版本的Visal Studio 2015(包括免费获取社区版本).Visual Studio 是一个集成开发环境(IDE),这意味着它不仅仅是一个编辑器,同时还包括了很多创建应用程序时所需要

在Windows上安装ROS2

前言:双系统来回切换比较麻烦,虚拟机性能又慢,因此在windows上安装ROS2是极佳的选择,ROS2支持在Win10上安装. 一.创建cmd快捷方式 右键新建快捷方式,输入以下命令: C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 右

在Windows上安装Python 方法步骤

Python 是夸平台的.要学习 Python  首先得把它安装到你的电脑上.下面介绍在Windows 平台上安装过程 在Windows上安装Python Python 官网:https://www.python.org/ 根据自己 Windows 系统版本64位还是32位,从官网下载对应的 Python 版本. 强烈推荐 安装 Python 3.x版本,2.x版马上就不再支持了. 下载 Python 下载完成点击安装: 注意勾上Add Python 3.7 to PATH,然后点“Instal

在Windows上安装虚拟机详细图文教程

用虚拟机来安装最新的软件,安装最新的系统等等比较保险,可以避免安装不顺利影响自己原来的系统和应用,想尝鲜又担心自己完全更换系统不适应的朋友可以尝试. 虚拟机下载:https://yunpan.cn/cqdKMyu9AWjsw  访问密码 7be7 在Windows上安装虚拟机. 选择自己的路径: 在桌面创建一个图标: 启动虚拟机,新建虚拟机,并进行各种硬件定制.

在 Windows 上安装 Hadoop 教程(转)

在 Windows 上安装 Hadoop 教程 一见 2010.1.6 www.hadoopor.com/[email protected] 1. 安装 JDK 不建议只安装 JRE,而是建议直接安装 JDK,因为安装 JDK 时,可以同时安装 JRE. MapReduce 程序的编写和 Hadoop 的编译都依赖于 JDK,光 JRE 是不够的. JRE 下载地址:http://www.java.com/zh_CN/download/manual.jsp JDK 下载地址:http://jav

windows上安装db2 spatial extender和ArcSDE的问题

因客户的DB2版本是9.7的版本,所以测试环境也只能安装这个版本,但在ArcSDE的最小支持版本里至少需要V9.7 pack 4的版本,低于这个版本是不行的. 安装DB2和spatial extender 安装好DB2后创建空间数据库(假如名字叫mysdedb),这里最好能优化一下以下的配置: 1.注意创建数据库时的字符编码. 2.最好创建自己的缓存池(使用16或者32k的pagesize). create bufferpool sdepool size 12800 pagesize 32K c

在Windows上安装MongoDB

原文官方文档:https://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-windows/ 基于版本:MongoDB 2.6 概览 通过这个示例在Windows上安装MongoDB. 平台支持: 从2.2版本开始,MongoDB不支持Windows XP了,请使用最新版本的Windows使用较新的MongoDB的版本. 重要: 如果你使用的Windows Server 2008 R2的edition版本或者是Windows 7,请安装a h

在Windows上安装Nexus 3.2.0-01

在Windows上安装Nexus 环境: Windows 7 apache-maven-3.3.9 JDK 1.8 下载Nexus: https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.2.0-01-win64.zip 解压后看可以到nexus-3.2.0-01和sonatype-work两个文件夹: 配置到系统环境Path:\Path\to\nexus 运行: Path\to\nexus\nexus-3.2.0-01\

在Windows上安装PyCUDA和Theano

最近几个月在学习Deep Learning,刚开始的时候什么条件都不具备.自己从淘宝上面买了一个GT 240,搭建一个GPU环境用于程序的调试.折腾了几个月,以前PyCUDA总是搭建失败,最近几天才尝试成功.为了学习Deep Learning的源代码,自己又搭建了Theano环境.由于时间紧张,自己概略总结如下,以备忘记. 一. 在Windows上安装PyCUDA 1. 安装条件 (1) pytools库 安装PyCUDA还需要pytools库,而pytools库又需要six,appdirs,d