简体   繁体   English

将Azure PowerShell Cmdlet加载到远程VM

[英]Load Azure PowerShell Cmdlets onto Remote VM

I am using PowerShell to automate the creation of a virtual machine in Azure, then using Remote PowerShell to run commands on that machine. 我使用PowerShell在Azure中自动创建虚拟机,然后使用远程PowerShell在该计算机上运行命令。 I can run any PowerShell command that ships with Windows perfectly well, but when I try to run something like: 我可以很好地运行Windows附带的任何PowerShell命令,但是当我尝试运行以下命令时:

Set-AzureSubscription or Get-AzureStorageBlobContent

I get the following message: 我收到以下消息:

The term 'Set-AzureSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. 术语“ Set-AzureSubscription”不被视为cmdlet,函数,脚本文件或可运行程序的名称。

Of course, because the Azure module is not preloaded on the VM in Azure. 当然,因为没有在Azure中的VM上预加载Azure模块。 Is it possible to copy the Azure Module up to the VM using PowerShell? 是否可以使用PowerShell将Azure模块复制到VM? Or any other way to go about this assuming everything must be automated with PowerShell (so I can't log into the VM to run the Azure PowerShell installer or copy and paste over a remote desktop session)? 还是采用其他方法(假设一切都必须使用PowerShell进行自动化)(因此,我无法登录到VM以运行Azure PowerShell安装程序或通过远程桌面会话进行复制和粘贴)?

Did use the Azure Powershell? 是否使用过Azure Powershell? If not you can install it here: 如果没有,您可以在这里安装:

http://azure.microsoft.com/en-gb/documentation/articles/install-configure-powershell/ http://azure.microsoft.com/zh-CN/documentation/articles/install-configure-powershell/

This is because you don't have Azure module installed 这是因为您没有安装Azure模块

Try this to check: Get-AzureModule Azure 尝试执行以下检查:Get-AzureModule Azure

You shoud get the module here: http://azure.microsoft.com/en-us/downloads/#cmd-line-Tools 您应该在此处获取该模块: http : //azure.microsoft.com/zh-cn/downloads/#cmd-line-Tools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM