标签: azure-pipelines

通过命令行向 Azure Active Directory 注册应用程序添加回复 URL

我有一个 Azure Active Directory 应用程序,它有各种回复 URL。我一直在 Azure 门户 AAD-> 注册应用程序-> 设置-> 回复 URLS 中手动添加回复 URL。

我的目标是能够运行一个 azure 管道任务,该任务可以从 azure 应用程序服务(我知道该怎么做)中检索我需要的回复 URL,并使用命令将其从 AAD 中的注册应用程序添加到回复 URL 列表中. 使用 Azure 管道任务列表中的 Azure-cli、Azure-powershell 或 Powershell。

如果有另一种方法可以完成另一项任务,我愿意接受建议。

这是我试过的:

在此处输入图片说明

这是日志/调试输出:

我想更好的问题是:

如何从 Azure DevOps 向 Azure CLI 任务授予权限以完成上一问题中的任务?

在此处输入图片说明

powershell azure-active-directory azure-cli azure-devops azure-pipelines

1
推荐指数
1
解决办法
2836
查看次数

Azure devops 中的拉取请求是否合并代码,然后运行构建定义

我有功能分支feature/feature1dev分支。我为我选择了构建定义的 dev 分支创建了一个分支策略。

当我从feature/feature1to发起拉取请求时,dev它是否合并了 2 个分支然后进行构建?或者它只是构建feature/feature1

 * [new branch]      dev                -> origin/dev
 * [new branch]      feature/feature2   -> origin/feature/feature2
 * [new branch]      feature/test       -> origin/feature/test
 * [new branch]      master             -> origin/master
 * [new branch]      release/release-1  -> origin/release/release-1
 * [new branch]      release/release-2  -> origin/release/release-2
 * [new ref]         refs/pull/37/merge -> pull/37/merge
##[command]git checkout --progress --force refs/remotes/pull/37/merge
Note: checking out 'refs/remotes/pull/37/merge'.
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines

1
推荐指数
1
解决办法
649
查看次数

无法更新 Azure Devops (VSTS) 扩展

在 Visual Studio Marketplace ( https://marketplace.visualstudio.com ) 中,我找到了一个扩展(版本 1),我现在在 Azure Devops构建管道中使用它。联系了小改进的作者,昨天推送了新版本的扩展。在 VS MarketPlace 中,我还看到 v2 已经可用。但是,当我进入我的构建管道时,我仍然只能选择版本 1。

我已经联系了我组织的管理员以确保安装了最新版本。我们甚至尝试删除组织的扩展(此时已反映在我的构建定义中)并重新安装它,但我仍然只能选择版本 1。

为什么我无法访问最新版本的扩展程序?

azure-devops azure-pipelines-build-task azure-pipelines

1
推荐指数
1
解决办法
1090
查看次数

从哪里获取 Azure Pipeline AppCenterDistribute@3 任务 destinationStoreId?

我正在我们的 Azure DevOps 管道中创建一个自动分发到我们的 AppCenter 以自动发布到 Google Play 商店。

我们管道中到 AppCenter 组的自动分发工作正常,如下所示:

- task: AppCenterDistribute@3
  inputs:
    serverEndpoint: 'AppCenter'
    appSlug: 'mycompany/appname'
    appFile: '**/android/bin/nl.mycompany.appname.apk'
    symbolsOption: 'Android'
    releaseNotesOption: 'input'
    releaseNotesInput: 'some comment'
    destinationType: 'groups'
    distributionGroupId: '813c4695-5f9c-4b10-973e-7awdcsd6'
Run Code Online (Sandbox Code Playgroud)

但是我无法通过以下方式分发到商店(通过 AppCenter):

- task: AppCenterDistribute@3
  inputs:
    serverEndpoint: 'AppCenter'
    appSlug: 'mycompany/appname'
    appFile: '**/android/bin/nl.mycompany.appname.apk'
    symbolsOption: 'Android'
    releaseNotesOption: 'input'
    releaseNotesInput: 'some comment'
    destinationType: 'store'
    destinationStoreId: 'Alpha'
Run Code Online (Sandbox Code Playgroud)

这将返回:

错误:ID 为 Alpha 的分发商店不存在。

知道在哪里可以destinationStoreId在 AppCenter 或其他地方找到吗?

yaml azure-devops azure-pipelines google-play-console visual-studio-app-center

1
推荐指数
1
解决办法
1252
查看次数

如何在 Azure DevOps Services 中传递/存储可从单元测试访问的机密

我需要在从环境变量中检索的单元测试执行中使用秘密密码。

测试由版本 2.* 中的 Visual Studio 测试任务执行

_networkCredential = new NetworkCredential(Environment.GetEnvironmentVariable("DomainAccountUsername"), Environment.GetEnvironmentVariable("DomainAccountPassword"));
Run Code Online (Sandbox Code Playgroud)

如果我直接从 Powershell 设置 DomainAccountPassword 一切正常,测试成功结束,但我不想向团队中的其他用户显示密码。

Write-Host "##vso[task.setvariable variable=DomainAccountPassword;]MyExamplePassword"
Run Code Online (Sandbox Code Playgroud)

传递库组中定义的机密不起作用,导致身份验证错误。

Write-Host "##vso[task.setvariable variable=DomainAccountPassword;]$(secretPassword)"
Run Code Online (Sandbox Code Playgroud)

如何将机密传递给 VSTS 任务,以便它可以在外部 API 中进行身份验证?

谢谢你!

vstest azure-devops azure-pipelines

1
推荐指数
1
解决办法
3927
查看次数

Azure DevOps:迁移到 .NET Core 3.0 后管道中断

我有一个包含多个 .NET Standard 2.0、.NET Standard 2.1、.NET Core 3.0 和完整 .NET Framework 4.8 项目的解决方案。管道如下所示:

  pool:
    name: Azure Pipelines
    demands:
    - msbuild
    - visualstudio

  variables:
    BuildPlatform: 'any cpu'
    BuildConfiguration: 'release'

  steps:
  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk 3.0'
    inputs:
      version: 3.0.100

  - task: DotNetCoreCLI@2
    displayName: 'dotnet restore'
    inputs:
      command: restore
      projects: '**/*.csproj'

  - task: NuGetToolInstaller@1
    displayName: 'Use NuGet 4.9.1'
    inputs:
      versionSpec: 4.9.1
      checkLatest: true

  - task: NuGetCommand@2
    displayName: 'NuGet restore'

  - task: VSBuild@1
    displayName: 'Build solution **\*.sln'
    inputs:
      vsVersion: 16.0 …
Run Code Online (Sandbox Code Playgroud)

nuget-package-restore azure-devops azure-pipelines asp.net-core-3.0

1
推荐指数
1
解决办法
1522
查看次数

Windows Server 2019 上的 Azure 管道 powershell 和 git 在输出中出现错误

我的 azure 管道和我的一台服务器有问题。

失败的服务器是 Windows 2019 服务器。

如果我在 powershell 中调用 git,那么它会将所有警告和以下行视为错误。如果我在两台不同的服务器上做同样的事情 - 没有问题 - 即使输出相同。

这是返回的错误:

CD to  D:\web\test\testsite.com
 ##[error]git : Warning: Permanently added the RSA host key for IP address 'X' to the list of known hosts.
##[error]git : From bitbucket.org:SITE
##[error]At C:\azagent\A1\_work\_temp\c1ff2d2b-c773-4adc-9040-155e92a914bd.ps1:12 char:1
+ git pull origin master
+ ~~~~~~~~~~~~~~~~~~~~~~
##[error]    + CategoryInfo          : NotSpecified: (From bitbucket....b/fletcocarpets:String) [], RemoteException
##[error]    + FullyQualifiedErrorId : NativeCommandError
##[error] 
##[error]PowerShell exited with code '1'.
Run Code Online (Sandbox Code Playgroud)

Git 确实进行了拉动,实际上一切正常。但出于某种原因 - 在此服务器上 - azure 管道将文本视为错误。

任何想法为什么?很难在文本上正确解释问题。 …

powershell azure azure-devops azure-pipelines

1
推荐指数
1
解决办法
313
查看次数

如何使用 Azure DevOps Release Pipelines 在 Azure Web App 中的 wwwroot 目录外部署文件

我有一个托管在 Azure 中的 Web 应用程序,文件wwwroot夹中包含一些文件。我在 之外还有其他人wwwroot,实际上在components同级调用的目录中。

到目前为止,我一直在使用 Kudu 控制台手动更新文件,将 ZIP 文件放入components. 我已经开始将我的流程转移到 Azure Pipelines;我设法配置了一个构建管道,该管道自动生成并压缩文件/工件以放入components.

现在我正在尝试配置发布管道以将文件从构建部署到components. 问题是我无法在默认情况下或从 Marketplace 中找到允许我将目标路径配置为的任务componentswwwroot默认情况下,它们都针对部署。

是否有任何类型的任务或脚本来实现这一目标?

这是我第一次面对使用 Azure Pipelines 设置 CI/CD,也许我忽略了一些东西。

kudu azure-devops azure-pipelines azure-pipelines-release-pipeline azure-webapps

1
推荐指数
1
解决办法
1138
查看次数

构建管道的默认分支。这是什么意思?

在 Azure DevOps Services 的发布工作流中,在设置持续部署触发器时,有这个选项

'构建管道的默认分支'

. 我不明白这意味着什么,以及如何查看项目中不同管道的默认分支。对这方面文档的任何参考也将有所帮助

这也出现在管道中的其他几个地方,但我现在不记得了。

谢谢,

在此处输入图片说明

azure-devops azure-pipelines azure-pipelines-release-pipeline

1
推荐指数
1
解决办法
2154
查看次数

Devops YAML - 使用表达式设置构建名称

在 yaml 构建中,是否可以使用表达式设置构建名称;如果我可以将发布管道与实际构建 ID 相匹配,那将是有利的。

例子:

trigger:  
- master

variables:  
    major: 2  
    minor: 3  
    offset: 2000  
    bid: $[$build.BuildID -as [int] + $offset]

name: "$(major).$(minor).$(bid)"

Run Code Online (Sandbox Code Playgroud)

variables yaml expression build-numbers azure-pipelines

1
推荐指数
1
解决办法
1261
查看次数