As workaround , you need to checkout the repo where the config file is located to the current source. If you are using yaml pipeline, you can define checkout step in yaml file, By this, you can fetch and check out other repositories in addition to the one you use to store your YAML pipeline. If you are using classic pipeline, you can do this by writing a script: git clone https://github.com/Microsoft/TypeScript.git
. If the repo is not public, you will need to pass authentication to the Git command.
Then the simple way is using Kudu REST API to copy file to azure app service.
Example code:
function Upload-FileToWebApp($kuduApiAuthorisationToken, $webAppName, $fileName, $localPath ){
$kuduApiUrl = "https://$webAppName.scm.azurewebsites.net/api/vfs/site/wwwroot/app/resources/$fileName"
$result = Invoke-RestMethod -Uri $kuduApiUrl `
-Headers @{"Authorization"=$kuduApiAuthorisationToken;"If-Match"="*"} `
-Method PUT `
-InFile $localPath `
-ContentType "multipart/form-data"
}
In addition, here is a ticket you can refer to.