forked from RuiRomano/pbimonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tool - PublishAzureFunctionZip.ps1
37 lines (20 loc) · 1.22 KB
/
Tool - PublishAzureFunctionZip.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ErrorActionPreference = "Stop"
$currentPath = (Split-Path $MyInvocation.MyCommand.Definition -Parent)
$azureFunctionDevFolder = "$currentPath\AzureFunction"
$publishFolder = "$currentPath"
$publishFolderTemp = "$publishFolder\temp"
#ensure folders
New-Item -ItemType Directory -Path $publishFolderTemp -Force -ErrorAction SilentlyContinue | Out-Null
New-Item -ItemType Directory -Path $publishFolderTemp\Scripts -Force -ErrorAction SilentlyContinue | Out-Null
#copy azure function
Get-ChildItem $azureFunctionDevFolder -Exclude @(".*","local.*") | Copy-Item -Destination $publishFolderTemp -Force -Recurse
$scripts = @(Get-ChildItem -File -Path "$currentPath\Fetch*.ps1") + @(Get-ChildItem -File -Path "$currentPath\Fetch*.psm1")
$scripts | Copy-Item -Destination "$publishFolderTemp\Scripts" -Force
#zip
Compress-Archive -Path "$publishFolderTemp\*" -CompressionLevel Optimal -DestinationPath "$publishFolder\AzureFunction.zip" -Force
Remove-Item $publishFolderTemp -Force -Recurse
Write-Host "Next Steps:"
Write-Host "- Create an Azure Function with PowerShell"
Write-Host "- Using Kudo ZIP Deploy, deploy the AzureFunction.zip"
Write-Host "- Configure the Configuration Settings on Azure Function"
Write-Host "- Run the function"