Zip deployment for Azure Functions - JackyChiou/jackychiou.github.io GitHub Wiki

CURL Command
curl -k -X POST -u $pythonfuncapptestRG --data-binary @"C:\YourPath\pythoncode.zip" https://pythonfuncapptestrg.scm.yourdomain.com/api/zipdeploy 

Powershell command:

# Avoiding SSL Warning for invalid certificate
##############################################
add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
##############################################
# Force TLs 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
   
$username = "`$pythonfuncapptestRG"
$password = "YourPassword"
$filePath = "C:\YourPath\pythoncode.zip"
$apiUrl = "https://pythonfuncapptestrg.scm.yourdomain.com/api/zipdeploy"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
$userAgent = "powershell/1.0"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method POST -InFile $filePath -ContentType "application/x-www-form-urlencoded" -Verbose -Debug

For more information: Zip deployment for Azure Functions https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push

HTH. 2019-11-5 By Jacky

⚠️ **GitHub.com Fallback** ⚠️