Azure project Kudu accepts uploaded zip file to the Zipdeploy endpoint but does not deploy

前端 未结 1 541
礼貌的吻别
礼貌的吻别 2020-12-22 06:09

I have an ASP.NET Core 2.0 API as an Azure App Service with a deployment slot for QA that I have been using for a few months. I develop in VS2017 and I publish to Azure usin

相关标签:
1条回答
  • 2020-12-22 07:05

    I think the problem is that Invoke-WebRequest doesn't honor creds passed in the URL. Instead, you need to pass the basic auth header explicitly.

    Try something like this:

    $webapp = "MyApp"
    $username = "`$MyApp"
    $password = "ThePasswordFromPublishProfile"
    # Note that the $username here should look like `SomeUserName`, and **not** `SomeSite\SomeUserName`
    $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
    
    $apiUrl = "https://$webapp.scm.azurewebsites.net/api/zipdeploy"
    $filePath = "C:\Temp\books.zip"
    Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method POST -InFile $filePath -ContentType "multipart/form-data"
    

    See also here for related info.

    0 讨论(0)
提交回复
热议问题