From 8bec43dd3b394c0fcef3a6e4e2a370f8758ceee7 Mon Sep 17 00:00:00 2001 From: lmiroslaw Date: Wed, 11 Jan 2017 10:50:35 +0100 Subject: [PATCH] Some suggestions on 110,120 and 150 --- Scripts/110-create-resource-group.ps1 | 7 +++++++ Scripts/120-create-storage.ps1 | 3 ++- Scripts/150-create-function.ps1 | 10 ++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Scripts/110-create-resource-group.ps1 b/Scripts/110-create-resource-group.ps1 index aecb905..2c8c226 100644 --- a/Scripts/110-create-resource-group.ps1 +++ b/Scripts/110-create-resource-group.ps1 @@ -1,3 +1,10 @@ +# Minimal requirement: Powershell version 3.3 + +# If you run into problems: +# 1. Run this command to check your Powershell version +# (Get-Module -ListAvailable | Where-Object{ $_.Name -eq 'Azure' }) | Select Version, Name, Author, PowerShellVersion  | Format-List; +# 2. Use Windows Web Installer to update Azure for Powershell: https://www.microsoft.com/web/downloads/platform.aspx + $ErrorActionPreference = "Stop" $scriptDir=($PSScriptRoot, '.' -ne "")[0] . "$scriptDir\Include\common.ps1" diff --git a/Scripts/120-create-storage.ps1 b/Scripts/120-create-storage.ps1 index c5a7c33..f8f8ff1 100644 --- a/Scripts/120-create-storage.ps1 +++ b/Scripts/120-create-storage.ps1 @@ -3,7 +3,8 @@ $scriptDir=($PSScriptRoot, '.' -ne "")[0] . "$scriptDir\Include\common.ps1" #region - create storage account (for ADF U-SQL script, as well as ML data) -if (-Not(Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName -ErrorAction SilentlyContinue)) { +if (-Not(Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName -ErrorAction SilentlyContinue)) { + Write-Host "Creating the storage and containers..." -ForegroundColor Green New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName -Location $location -SkuName Standard_LRS New-AzureStorageContainer -Context (getStorageContext) -Name adf-resources New-AzureStorageContainer -Context (getStorageContext) -Name interaction-data diff --git a/Scripts/150-create-function.ps1 b/Scripts/150-create-function.ps1 index 1d77818..9a21979 100644 --- a/Scripts/150-create-function.ps1 +++ b/Scripts/150-create-function.ps1 @@ -4,12 +4,15 @@ $scriptDir=($PSScriptRoot, '.' -ne "")[0] Write-Host "Create a Function App..." -ForegroundColor Green +#Comments: the link did not work for me. Maybe add more precise instructions how to navigate on the Portal. +# Should I create a seperate Storage for Function App or can I use the one that is already created? + Write-Host -ForegroundColor Magenta "Perform this manual configuration" Write-Host -ForegroundColor Magenta "`nNavigate to:" $sub=(Get-AzureRmContext).Subscription.SubscriptionId Write-Host -ForegroundColor Magenta "https://portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBlade/id/%2Fsubscriptions%2F$sub%2FresourceGroups%2F$resourceGroupName%2Fproviders%2FMicrosoft.Web%2Fsites%2F$functionAppName" Write-Host -ForegroundColor Magenta "`nCreate new resource of type Function App, name '$functionAppName'. When Function App is created, navigate to it." -Write-Host -ForegroundColor Magenta "`nClick New Function -> GenericWebHook-CSharp -> Name your function '$functionName'. Paste following code: " +Write-Host -ForegroundColor Magenta "`nOn the welcome screen click New Function -> Select WebHook+Api -> Select CSharp. Then Select New Function -> Choose GenericWebHook-Csharp template -> Name your function '$functionName'. Paste following code: " Write-Host -ForegroundColor Cyan (Get-Content -Path ..\Resources\PostToEventHubFunction\run.csx -Raw) #Doesn't work correctly @@ -52,13 +55,16 @@ $props = @{ New-AzureRmResource -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Web/sites/functions -ResourceName $functionAppName/$functionName -PropertyObject $props -ApiVersion 2015-08-01 -Force +} + +# These commands were not executed because they are part of the function that is not called. I moved them outside. ### $sub=(Get-AzureRmContext).Subscription.SubscriptionId $eventHubSendPolicyKey=(Get-AzureRmEventHubNamespaceKey -ResourceGroupName $resourceGroupName -NamespaceName $eventHubNamespace -AuthorizationRuleName $eventHubSendPolicyName).PrimaryConnectionString Write-Host -ForegroundColor Magenta "Perform this manual configuration" Write-Host -ForegroundColor Magenta "`nNavigate to:" Write-Host -ForegroundColor Magenta "https://portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBlade/id/%2Fsubscriptions%2F$sub%2FresourceGroups%2F$resourceGroupName%2Fproviders%2FMicrosoft.Web%2Fsites%2F$functionAppName" Write-Host -ForegroundColor Magenta "`nClick PostToEventHub -> Integrate -> Configure event hub:" -} + Write-Host -ForegroundColor Magenta "`nEvent hub name:" Write-Host -ForegroundColor Cyan $eventHubName