Created
September 2, 2018 04:33
-
-
Save takekazuomi/4c3f238449c06dfee0b9644aacb63c74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task Deploy -depends Archive -description "Deploy functions" -requiredVariables $name { | |
$container = "content" | |
$webapp = Get-AzureRmWebApp -Name $name | % {$_} | |
$h = @{} | |
$webapp.SiteConfig.AppSettings | % { $h[$_.Name] = $_.Value} | |
$zip = (Get-ChildItem "$buildDir/*.zip" | Select-Object -Last 1).FullName | |
$ctx = New-AzureStorageContext -ConnectionString $h["AzureWebJobsStorage"] | |
New-AzureStorageContainer -Name $container -Permission Off -Context $ctx -ErrorAction SilentlyContinue | Out-Null | |
$blob = Set-AzureStorageBlobContent -Container $container -BlobType Block -File $zip -Context $ctx -Force | |
$now = Get-Date | |
$sas = New-AzureStorageBlobSASToken -CloudBlob $blob.ICloudBlob -Context $ctx -FullUri -Permission r -ExpiryTime $now.AddYears(99) -StartTime $now.AddHours(-1) | |
$h["WEBSITE_USE_ZIP"] = "$sas" | |
$h["WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT"] = "1" | |
$webapp | Set-AzureRmWebApp -AppSettings $h -ResourceGroupName $webapp.ResourceGroup | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment