Module/DevOps/Copy-BCSRepository.ps1
<#
.SYNOPSIS Update Azure Pipeline files from Template Project .DESCRIPTION Update current.yml and build-settings.json from the project template repository and copy the files to your local project folder. .PARAMETER PipelineFilesFolder Local folder where to your AL project .PARAMETER Project DevOps project where the template repository exists, default is BrightCom Solutions .PARAMETER TemplateRepository Name of the template project repository, default is BCS AL Project Template .PARAMETER PipelineFilesSubFolder Path to local pipeline files, default is .azureDevOps .PARAMETER PipelineFileName Name of the pipeline yaml file, default is current.yml .PARAMETER PipelineBuildSettingsFileName Name of the pipeline build-settings file, default is build-settings.json .PARAMETER ContainerName Name of the container that is created when the pipeline runs. .PARAMETER DeployToTenant Tenant for where artifacts is to be deployed by the pipeline, must be a QA tenant. .EXAMPLE Update-BCSDevPipelineFiles -PipelineFilesFolder C:\Projects\myAlProject -ContainerName myAlProject -DeployToTenant desenioqa .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Copy-BCSRepository { Param ( [Parameter(Mandatory = $true)] [string]$organisation, [Parameter(Mandatory = $true)] [string]$projectName, [Parameter(Mandatory = $true)] [string]$repositoryName, [Parameter(Mandatory = $true)] [string]$sourceRepositoryUrl, [Parameter(Mandatory = $true)] [string]$sourcePersonalAccessToken ) try { $fullOrganisationUrl = "https://dev.azure.com/$organisation" $sourcePersonalAccessToken | az devops login --org $fullOrganisationUrl $env:AZURE_DEVOPS_EXT_GIT_SOURCE_PASSWORD_OR_PAT = $sourcePersonalAccessToken; $import = az repos import create --git-source-url $sourceRepositoryUrl --project $projectName --repository $repositoryName --organization $fullOrganisationUrl --requires-authorization --user-name "" | convertfrom-json; $import; } catch { throw "An error occured: $_.Exception"; } finally { az devops logout } } Export-ModuleMember -Function Copy-BCSRepository |