簡體   English   中英

PowerShell 通過 Azure 管道開啟 All.network

[英]PowerShell to turn on All network by Azure pipelines

我寫了一個 power-shell,它在 windows 機器上運行良好,由 PS editor 編輯。 在運行此之前,系統提示我的用戶名進行身份驗證。

$subscription = "dev"
Connect-AzAccount -Subscription $subscription
$keyvaultname = "kv-dev"
Update-AzKeyVaultNetworkRuleSet -DefaultAction Allow -VaultName $keyvaultname

當我在 Azure 管道(使用 PowerShell 任務)中運行相同的腳本時,它拋出以下錯誤。 我刪除了 Connect-AzAccount。

Update-AzKeyVaultNetworkRuleSet' is not recognized as the name of a cmdlet, function, 
script file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.

我如何使用 Power Shell 任務從 azure 管道運行它。

要在管道作業中執行 Azure PowerShell 命令來管理 Azure 資源,您應該使用Azure PowerShell 任務而不是PowerShell 任務

您需要設置一個Azure 資源管理器服務連接ARM 連接)以用於Azure PowerShell 任務 ARM 連接用作身份驗證,您不應直接在 PowerShell 腳本中設置身份驗證。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM