Deploy to azure functions using powershell

前端 未结 5 2223
一生所求
一生所求 2021-02-07 10:20

Is there any way, I can deploy to azure functions using powershell scripts? CI will not work for us because we use octopus deploy to deploy to all of our production services. So

5条回答
  •  粉色の甜心
    2021-02-07 10:52

    You can deploy functions to Azure using the Kudu REST API. You can also see some code/samples of doing this in our templates repository. In this code sample, you can see how our test script calls out to the Kudu Rest apis to deploy a zip to the Function App.

    The folder structure for functions is a function per folder. You need to deploy your Function folders to ./site/wwwroot on the Function App. You also need to add any app settings which might contain your secrets if you add any new bindings between updates.

    The PowerShell code would look something along the lines of:

        $apiUrl = $config.scmEndpoint + "/api/zip/"
        if ($destinationPath)
        {
            $apiUrl = $apiUrl + $destinationPath
        }
    
        $response = Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $config.authInfo)} -Method PUT -InFile $zipFilePath -ContentType "multipart/form-data"
    

提交回复
热议问题