如何使用凭据通过代理服务器运行 Azure powershell cmdlet?

发布于 2024-11-26 01:08:47 字数 1261 浏览 6 评论 0原文

当我运行以下 Powershell cmdlet(从 Azure 管理工具管理单元)时:

get-osversions -subscriptionId **** -certificate (get-item cert:\CurrentUser\MY\******)

我收到以下错误消息:

Get-OSVersions:远程服务器返回意外响应:(407) Proxy Authenti 阳离子 必需。 行数:1 字符:15 + 获取操作系统版本 <<<< -subscriptionId * -证书 (获取项目证书:\CurrentUser\MY*****) + CategoryInfo : CloseError: (:) [Get-OSVersions], ProtocolException +FullyQualifiedErrorId:Microsoft.Samples.AzureManagementTools.PowerShell.HostedS 服务.GetOSVersionsCommand

Get-OSVersions:未将对象引用设置为对象的实例。 行数:1 字符:15 + 获取操作系统版本 <<<< -subscriptionId * -证书 (获取项目证书:\CurrentUser\MY***) + CategoryInfo : CloseError: (:) [Get-OSVersions], NullReferenceException +FullyQualifiedErrorId:Microsoft.Samples.AzureManagementTools.PowerShell.HostedS 服务.GetOSVersionsCommand

这里的互联网代理服务器似乎拒绝了脚本所需的访问。

我在互联网上仔细查看了一下,似乎没有简单的方法来解决这个问题,因为这个 cmdlet 没有有效的“-credentials”或代理服务器参数。

我知道有一个“Get-Credential”cmdlet,但我认为它没有帮助。如何将凭据传递给 Azure cmdlet?

任何人都可以想出任何方法来解决这个问题吗?...

...除了使用不同的非代理互联网连接?

我很困惑。

非常感谢您抽出时间。

When I run the following Powershell cmdlet (from the Azure Management Tools Snapin):

get-osversions -subscriptionId **** -certificate (get-item cert:\CurrentUser\MY\******)

I get the following error message:

Get-OSVersions : The remote server returned an unexpected response: (407) Proxy Authenti
cation Required.
At line:1 char:15
+ get-osversions <<<< -subscriptionId * -certificate
(get-item cert:\CurrentUser\MY*****)
+ CategoryInfo : CloseError: (:) [Get-OSVersions], ProtocolException
+ FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedS
ervices.GetOSVersionsCommand

Get-OSVersions : Object reference not set to an instance of an object.
At line:1 char:15
+ get-osversions <<<< -subscriptionId * -certificate
(get-item cert:\CurrentUser\MY***)
+ CategoryInfo : CloseError: (:) [Get-OSVersions], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedS
ervices.GetOSVersionsCommand

It seems that the internet proxy server here is denying the script the access it requires.

I've had a good look around on the internet and it seems that there is no easy way around this problem since this cmdlet does not have a valid "-credentials" or proxy server parameter.

I know there is a 'Get-Credential' cmdlet but I don't think it helps. How would you pass the credential to the Azure cmdlet?

Can anyone think of any way to get around this issue?..

...other than using a different non-proxied internet connection?

I'm stumped.

Many Thanks for your time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓦然回首 2024-12-03 01:08:47

更轻松:

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Easier:

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
杀お生予夺 2024-12-03 01:08:47

A few customers I know were successful using the method outlined here (Supporting Basic Auth proxies). If you need other proxy types, it follows the same pattern. The nice thing about this is it does not require changing the cmdlets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文