Last active
November 2, 2018 05:39
-
-
Save olafloogman/fe164070b91eab7489795c07fbceb446 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
Param( | |
[string] $AppName | |
) | |
$ResourceGroupName = $AppName + "-rg" | |
$FunctionName = $AppName + "-func" | |
$needPsLogin = $true | |
Try | |
{ | |
$content = Get-AzureRmContext | |
if ($content) | |
{ | |
$needPsLogin = ([string]::IsNullOrEmpty($content.Account)) | |
} | |
} | |
Catch | |
{ | |
if ($_ -like "*Login-AzureRmAccount to login*") | |
{ | |
$needPsLogin = $true | |
} | |
else | |
{ | |
throw | |
} | |
} | |
if ($needPsLogin) | |
{ | |
Login-AzureRmAccount | |
} | |
.\FunctionAppProxy\Deploy-AzureResourceGroup.ps1 -ResourceGroupName $ResourceGroupName | |
Compress-Archive -Path .\AppContents\* -DestinationPath functionapp.zip -Force | |
$needAzLogin = $true | |
Try | |
{ | |
$content = az account show | |
if ($content) | |
{ | |
$needAzLogin = ([string]::IsNullOrEmpty($content)) | |
} | |
} | |
Catch | |
{ | |
if ($_ -like "*Please run 'az login' to setup account") | |
{ | |
$needAzLogin = $true | |
} | |
else | |
{ | |
throw | |
} | |
} | |
if ($needAzLogin) | |
{ | |
az login | |
} | |
az functionapp deployment source config-zip --src functionapp.zip --name $functionName --resource-group $ResourceGroupName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment