Skip to content

Instantly share code, notes, and snippets.

@olafloogman olafloogman/DeployAll.ps1
Last active Nov 2, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.