【发布时间】:2015-11-12 17:10:09
【问题描述】:
尝试编写脚本以在 Azure 上创建的 VM 上自动部署 Azure。昨天一切都只是花花公子。我进行了设置,所有服务都部署到了它们各自的订阅中。
我的证书区也有许多 Azure 管理证书。我已经把它们全部清除了,因为除了一个很旧。然后我重新导入了最新的发布设置文件,希望从头开始,一切都会再次快乐。
然后我今天登录,运行我的一个部署,它说:
The server failed to authenticate the request.
Verify that the certificate is valid and is associated with this subscription.
没问题,只需使用方便的 add-azureaccount,它会让我重新登录,重新运行部署并再次显示:
Set-AzureService : ForbiddenError: The server failed to authenticate the
request. Verify that the certificate is valid and is associated with this
subscription.
有人知道如何通过服务器验证吗?
我在 Azure 上创建并在 VM 上安装 Teamcity 的 VM 上进行的所有这些自动化操作。 当我尝试直接在 VM Powershell 上运行脚本时,它工作正常 但是当我尝试运行 Teamcity 配置时出现错误,它在 PowerShell 构建步骤中失败。
它虽然通过命令返回 VM 上的订阅 获取 Azure 订阅
[11:31:07][步骤 3/3] SubscriptionId : *******
[11:31:07][步骤 3/3] 订阅名称:****
[11:31:07][步骤 3/3] 环境:AzureCloud
[11:31:07][步骤 3/3] SupportedModes:AzureServiceManagement
[11:31:07][步骤 3/3] 默认帐户:*******
[11:31:07][步骤 3/3] 帐户:*******
[11:31:07][步骤 3/3] IsDefault : True
[11:31:07][步骤 3/3] IsCurrent : True
[11:31:07][步骤 3/3] CurrentStorageAccountName : *******
[11:31:07][步骤 3/3] 租户 ID:
[11:31:07][步骤 3/3] SubscriptionId : *******
[11:31:07][步骤 3/3] 订阅名称 : *******
[11:31:07][步骤 3/3] 环境:AzureCloud
[11:31:07][步骤 3/3] SupportedModes:AzureServiceManagement
[11:31:07][步骤 3/3] 默认帐户:*******
[11:31:07][步骤 3/3] 帐户:*******
[11:31:07][步骤 3/3] IsDefault : False
[11:31:07][步骤 3/3] IsCurrent : False
[11:31:07][步骤 3/3] CurrentStorageAccountName : 关税 API
[11:31:07][步骤 3/3] 租户 ID:
[11:31:07][步骤 3/3]
[11:31:07][步骤 3/3]
[11:31:07][步骤 3/3]
[11:31:21][Step 3/3] Set-AzureService : ForbiddenError: The server failed to >authenticate
[11:31:21][步骤 3/3] 请求。验证证书是否有效并且>与此相关
[11:31:21][步骤 3/3] 订阅。
[11:31:21][步骤 3/3] 在 line:1 char:1
[11:31:21][步骤 3/3] + Set-AzureService -ServiceName $service -Label $部署标签
[11:31:21][步骤 3/3] + >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [11:31:21][步骤 3/3] + CategoryInfo : CloseError: (:) [Set->AzureService], ComputeCloud
[11:31:21][步骤 3/3] 例外
[11:31:21][步骤 3/3] + FullyQualifiedErrorId : >Microsoft.WindowsAzure.Commands.ServiceManagemen
[11:31:21][步骤 3/3] t.HostedServices.SetAzureServiceCommand
谁能知道这里出了什么问题?
【问题讨论】:
-
我在 azure 自动化上也面临同样的问题,我正在尝试使用 ssh 公钥创建 vm,但在此命令上遇到相同的错误 Set-AzureSubscription -SubscriptionName 'xxxxxxxx' -SubscriptionId xx -CurrentStorageAccountName 'xxxx' -Certificate $Certificate ,如何解决问题。请
-
我知道这个问题已经很老了,但万一它仍然造成麻烦/其他人也有同样的问题。迁移到新的 publishsettings 证书时,我遇到了同样的问题。由于某种原因默认使用旧的 azure 证书帐户的机器。要解决此问题,请运行
Get-AzureAccount。如果有与旧/过期证书关联的帐户,请运行Remove-AzureAccount <certificateThumbprint>。
标签: powershell azure deployment automation teamcity