如何使用 Azure 自动化运行手册将 Azure devops 存储库下载为 zip 文件?

How do I download Azure devops repo as a zip file using Azure automation runbook?

我正在尝试创建一个自动化 运行 手册来备份我们的一个 Azure Devops 存储库并将其作为 Zip 文件存储在存储帐户中。但是当我 运行 Git 克隆到 运行 书中(导入 posh-git 模块)时,我收到以下错误。有什么方法可以使用 Automation Runbook 将整个 git 存储库下载为 Zip 文件?

git : Cloning into 'testrepo'... At line:1 char:1 
+ git clone https://FAKEehtinrtsndtsrihdintsrhdinrhtidhtsrdFAKE... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo : NotSpecified: (Cloning into 'testrepo'...:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError

我创建了一个 DevOps 管道,用于将存储库作为 Zip 文件克隆、归档和复制到存储帐户,并为 Zip 文件设置 10 天保留期。 以下是步骤:

  1. Azure storage account 中创建一个容器。
  2. 在 Azure DevOps 中生成一个新的 PAT,具有 'Read' 对 'Code'
  3. 的访问权限
  4. 在 Azure DevOps 中创建一个新的 service connection 以访问包含存储帐户的 Azure 订阅。
  5. 使用代码 here 创建 YAML 管道。