AL/Get-AppJsonForProjectAndRepo.ps1
function Get-AppJsonForProjectAndRepo { Param( [Parameter(Mandatory=$true)] [string] $devOpsOrganization, [Parameter(Mandatory=$true)] [string]$devOpsProjectName, [Parameter(Mandatory=$true)] [string] $devOpsToken, [Parameter(Mandatory=$false)] [string]$RepositoryName, [Parameter(Mandatory=$false)] [string]$Publisher, [Parameter(Mandatory=$false)] [string]$BranchName = "master", [switch] $GetTestApp ) if ($Publisher -eq 'Microsoft') { return '{}' } $devOpsProjectName = (Get-DevOpsProjects -devOpsOrganization $devOpsOrganization -devOpsToken $devOpsToken | Where-Object name -like ('*{0}*' -f $devOpsProjectName)).name if ($null -eq $RepositoryName -or $RepositoryName -eq '') { $RepositoryName = $devOpsProjectName } $AppContent = Invoke-AzureDevOpsApi ('https://dev.azure.com/{0}/{1}/_apis/git/repositories/{2}/items?recursionLevel=full&scopePath=app.json&version={3}' -f $devOpsOrganization, $devOpsProjectName, (Get-RepositoryId -devOpsOrganization $devOpsOrganization -devOpsProjectName $devOpsProjectName -RepositoryName $RepositoryName -devOpsToken $devOpsToken), $BranchName) -devOpsToken $devOpsToken -GetContents $AppJson = ConvertFrom-Json $AppContent $AppJson } Export-ModuleMember Get-AppJsonForProjectAndRepo |