代码之家  ›  专栏  ›  技术社区  ›  Ariel Larisma

如何在Visual Studio中运行Azure Powershell cmdlet

  •  0
  • Ariel Larisma  · 技术社区  · 6 年前
    Install-Module AzureAD 
    $password = ConvertTo-SecureString "password" -AsPlainText -Force
    $Cred = New-Object System.Management.Automation.PSCredential ("username@dev.com", $password)
    Connect-AzureAD -Credential $Cred
    

    这是我的Azure Powershell脚本示例。我已经通过Windows PowerShell ISE运行了它。是否有任何方法可以使用Visual Studio 2017运行Azure cmdlet?或任何可用于引用Azure Powershell命令库的Nuget包?

    谢谢

    2 回复  |  直到 6 年前
        1
  •  1
  •   CHEEKATLAPRADEEP    6 年前

    您可以安装 PowerShell Tools from the Visual Studio Installer 作为单个组件或“Azure开发”工作负载的一部分。

    要将PowerShell工具作为单个组件安装,请执行以下操作:

    1. 单击“单个组件”选项卡。
    2. 列表项滚动至“代码工具”部分。
    3. 选中“PowerShell工具”。
    4. 单击“安装”或“修改”应用更改。

    enter image description here

    安装后,单击“视图”=>其他窗口=>PowerShell交互式窗口=>并运行cmdlet:

    enter image description here

        2
  •  0
  •   Tom Sun    6 年前

    PRADEEP附加。我们可以使用Visual Studio安装程序安装Powershell工具。我们还可以从VS扩展和更新中安装它。

    enter image description here

    之后,我们可以创建PowerShell项目和脚本。我们还可以在VS中调试和运行scrpits。

    enter image description here

    注: 如果您想安装模块,那么我们需要使用 管理员权限 ,或将获取错误信息 Administrator rights are required to install modules

    enter image description here