1

私はリソースマネージャーにVMを持っており、これらのVMをrunbookからリモートPowerShellスクリプトを実行したいと思っています。私はすでに古典的なバーチャルマシンでそれを行い、成功する方法を知っています。リソースマネージャからPSSession VMを取得する方法

Azure Resource Managerで作成されたAzure VMでは、デフォルトで証明書が有効になっているリモートPowerShell over SSLが使用されていますか? Enter-PSSessionまたはInvoke-Commandとの接続方法を教えてください。

私はこのコードを無事に試しました。

Enter-PSSession -ComputerName <public-IP> -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) 

そして、私はこのエラー

Enter-PSSession : Connecting to remote server <public-IP> failed with the following error message : The WinRM client 
cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not 
joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts 
configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not 
be authenticated. You can get more information about that by running the following command: winrm help config. For more 
information, see the about_Remote_Troubleshooting Help topic. 

注ました:私はAzureのオートメーションでPowerShellのRunbookのでこれを実行していることを。 here

+0

VMリモートPowerShellをHTTPSで設定して、やり直してください。 'Transport = HTTPS'と' Port = 5986'が必要です。 –

+0

@JackZeng既に= '(ただし、まだリモーティングに成功していません。 –

答えて

1

ARM VMにWinRMを有効にするには、Azure Key Vault(および他のいくつかの手順)にcertを入れる必要があります。 Connect-AzureVM runbookと同じことをする必要がありますが、Azure Classic VMの証明書の代わりにこの証明書を使用して、ホスト間の信頼関係を設定してください。

必要な手順の詳細については、this threadを参照してください。 Thisも有用である。

+0

私はまだ接続できません='(私もここで手順をたどっています - > https://blogs.technet.microsoft.com/uktechnet/2016/02/ –

+0

Powershellを使用してローカルコンピュータにEnter-PSSessionを試してみましたが、正常に動作しました。リモートサーバのpublic_ipをtrustedhostに置くだけです。 –

+0

Azure Automationのような無人セッションでEnter-PSSessionを使うことはできません。コードがセッションに入ったら、指定できるユーザーはいません次のコマンドを実行します。Invoke-Commandについて – Joe

関連する問題