【问题标题】:Visual Studio Team Services release issueVisual Studio Team Services 发布问题
【发布时间】:2016-11-30 12:50:43
【问题描述】:

当我尝试在 Visual Studio 中创建版本时,我遇到了这个错误

天蓝色部署

鉴于我对我的 Azure 帐户拥有完全权限,并且我在登录我的 azure 会话时没有任何问题

我认为这是 VSTS 中的一个错误,问题是,如何调整这种情况?在我知道如何发布之前,我可以临时使用 Visual Studio 2013 的发布管理工具吗

Rem:我尝试了使用 powershell 获取有关主体 id、租户 id 等信息的旧方法,但是这种方法需要我的应用程序必须由 AAD 支持,而我们的情况并非如此,其次是这种方法现在应该被弃用了

我们将不胜感激任何帮助

谢谢

【问题讨论】:

  • 通过该 PowerShell 脚本获取主体 ID、租户 ID,然后添加 Azure 资源管理器服务端点的结果是什么?
  • 主体ID为空
  • “Azure RM 订阅”字段中的订阅 ID 是您手动输入的吗?
  • @user2050269 是否出现错误?

标签: deployment azure-devops


【解决方案1】:

它对我来说很好用。 (点击授权按钮成功配置Azure服务连接)。

您可以清除Internet浏览器缓存,然后启动InPrivate Browsing,您可以在其他机器上尝试。

》我尝试了使用 powershell 获取有关主体 id、租户 id 等信息的旧方法,但这种方法需要我的应用程序必须由 AAD 支持,而我们的情况并非如此强>

你不需要手动配置 ADD 支持的应用,只需要直接运行这个 PowerShell 脚本(参考this 文章)

param
(
    [Parameter(Mandatory=$true, HelpMessage="Enter Azure Subscription name. You need to be Subscription Admin to execute the script")]
    [string] $subscriptionName,

    [Parameter(Mandatory=$true, HelpMessage="Provide a password for SPN application that you would create")]
    [string] $password,

    [Parameter(Mandatory=$false, HelpMessage="Provide a SPN role assignment")]
    [string] $spnRole = "owner"
)

#Initialize
$ErrorActionPreference = "Stop"
$VerbosePreference = "SilentlyContinue"
$userName = $env:USERNAME
$newguid = [guid]::NewGuid()
$displayName = [String]::Format("VSO.{0}.{1}", $userName, $newguid)
$homePage = "http://" + $displayName
$identifierUri = $homePage


#Initialize subscription
$isAzureModulePresent = Get-Module -Name AzureRM* -ListAvailable
if ([String]::IsNullOrEmpty($isAzureModulePresent) -eq $true)
{
    Write-Output "Script requires AzureRM modules to be present. Obtain AzureRM from https://github.com/Azure/azure-powershell/releases. Please refer https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/DeployAzureResourceGroup/README.md for recommended AzureRM versions." -Verbose
    return
}

Import-Module -Name AzureRM.Profile
Write-Output "Provide your credentials to access Azure subscription $subscriptionName" -Verbose
Login-AzureRmAccount -SubscriptionName $subscriptionName
$azureSubscription = Get-AzureRmSubscription -SubscriptionName $subscriptionName
$connectionName = $azureSubscription.SubscriptionName
$tenantId = $azureSubscription.TenantId
$id = $azureSubscription.SubscriptionId


#Create a new AD Application
Write-Output "Creating a new Application in AAD (App URI - $identifierUri)" -Verbose
$azureAdApplication = New-AzureRmADApplication -DisplayName $displayName -HomePage $homePage -IdentifierUris $identifierUri -Password $password -Verbose
$appId = $azureAdApplication.ApplicationId
Write-Output "Azure AAD Application creation completed successfully (Application Id: $appId)" -Verbose


#Create new SPN
Write-Output "Creating a new SPN" -Verbose
$spn = New-AzureRmADServicePrincipal -ApplicationId $appId
$spnName = $spn.ServicePrincipalName
Write-Output "SPN creation completed successfully (SPN Name: $spnName)" -Verbose


#Assign role to SPN
Write-Output "Waiting for SPN creation to reflect in Directory before Role assignment"
Start-Sleep 20
Write-Output "Assigning role ($spnRole) to SPN App ($appId)" -Verbose
New-AzureRmRoleAssignment -RoleDefinitionName $spnRole -ServicePrincipalName $appId
Write-Output "SPN role assignment completed successfully" -Verbose


#Print the values
Write-Output "`nCopy and Paste below values for Service Connection" -Verbose
Write-Output "***************************************************************************"
Write-Output "Connection Name: $connectionName(SPN)"
Write-Output "Subscription Id: $id"
Write-Output "Subscription Name: $connectionName"
Write-Output "Service Principal Id: $appId"
Write-Output "Service Principal key: <Password that you typed in>"
Write-Output "Tenant Id: $tenantId"
Write-Output "***************************************************************************"

【讨论】:

  • 当我得到这样的 TenantId 时,输出是 *******,这就是它在日志中的显示方式,还是它实际上像这样存储在我的 var 中?
  • @m1nkeh 不,它应该是实际值。你在windows powershell中运行它吗?
  • 做了 $var.length,它返回为 32,所以我假设它只是 VSTS 从日志中隐藏了值,我会将它传递给我的 ARM 模板,看看它是否作品! :D
猜你喜欢
  • 2013-03-18
  • 1970-01-01
  • 1970-01-01
  • 2018-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多