From acc910de3e1a2459e394e33197300cdedb418904 Mon Sep 17 00:00:00 2001 From: Ryan Gammon Date: Thu, 24 Oct 2019 17:21:14 -0700 Subject: [PATCH] Set app registration homepage to skill url as part of deploy. This allows both admins and tooling to establish the url of the skill. --- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../emailskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../eventskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../itsmskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../musicskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../newsskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../phoneskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../todoskill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../SkillSample/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../Skill/Deployment/Scripts/deploy.ps1 | 35 ++++++++++++++----- .../deployment/scripts/deploy.ps1 | 33 +++++++++++++---- .../deployment/scripts/deploy.ps1 | 33 +++++++++++++---- 18 files changed, 484 insertions(+), 142 deletions(-) diff --git a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/calendarskill/calendarskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/calendarskill/calendarskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/calendarskill/calendarskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/calendarskill/calendarskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/emailskill/emailskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/emailskill/emailskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/emailskill/emailskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/emailskill/emailskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/bingsearchskill/bingsearchskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/bingsearchskill/bingsearchskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/bingsearchskill/bingsearchskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/bingsearchskill/bingsearchskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/eventskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/eventskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/eventskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/eventskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/hospitalityskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/hospitalityskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/hospitalityskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/hospitalityskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/itsmskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/itsmskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/itsmskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/itsmskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/musicskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/musicskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/musicskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/musicskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/newsskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/newsskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/newsskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/newsskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/restaurantbooking/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/restaurantbooking/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/restaurantbooking/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/restaurantbooking/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/experimental/weatherskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/experimental/weatherskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/experimental/weatherskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/experimental/weatherskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/phoneskill/phoneskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/phoneskill/phoneskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/phoneskill/phoneskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/phoneskill/phoneskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/pointofinterestskill/pointofinterestskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/pointofinterestskill/pointofinterestskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/skills/src/csharp/todoskill/todoskill/Deployment/Scripts/deploy.ps1 b/skills/src/csharp/todoskill/todoskill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/skills/src/csharp/todoskill/todoskill/Deployment/Scripts/deploy.ps1 +++ b/skills/src/csharp/todoskill/todoskill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/deploy.ps1 b/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/deploy.ps1 +++ b/templates/Skill-Template/csharp/Sample/SkillSample/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/deploy.ps1 b/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/deploy.ps1 index 42e2c12e50..93e74311f2 100644 --- a/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/deploy.ps1 +++ b/templates/Skill-Template/csharp/Template/Skill/Deployment/Scripts/deploy.ps1 @@ -75,28 +75,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -205,7 +221,10 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'" - + + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/templates/Virtual-Assistant-Template/typescript/generator-botbuilder-assistant/generators/skill/templates/sample-skill/deployment/scripts/deploy.ps1 b/templates/Virtual-Assistant-Template/typescript/generator-botbuilder-assistant/generators/skill/templates/sample-skill/deployment/scripts/deploy.ps1 index b4636d498b..f68869becb 100644 --- a/templates/Virtual-Assistant-Template/typescript/generator-botbuilder-assistant/generators/skill/templates/sample-skill/deployment/scripts/deploy.ps1 +++ b/templates/Virtual-Assistant-Template/typescript/generator-botbuilder-assistant/generators/skill/templates/sample-skill/deployment/scripts/deploy.ps1 @@ -77,28 +77,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -207,6 +223,9 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($srcDir)' -languages '$($languages)'" + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow diff --git a/templates/Virtual-Assistant-Template/typescript/samples/sample-skill/deployment/scripts/deploy.ps1 b/templates/Virtual-Assistant-Template/typescript/samples/sample-skill/deployment/scripts/deploy.ps1 index b4636d498b..f68869becb 100644 --- a/templates/Virtual-Assistant-Template/typescript/samples/sample-skill/deployment/scripts/deploy.ps1 +++ b/templates/Virtual-Assistant-Template/typescript/samples/sample-skill/deployment/scripts/deploy.ps1 @@ -77,28 +77,44 @@ if (-not $luisAuthoringKey) { } } +$app = $null + if (-not $appId) { # Create app registration - $app = (az ad app create ` + $appJson = (az ad app create ` --display-name $name ` --password `"$($appPassword)`" ` --available-to-other-tenants ` --reply-urls 'https://token.botframework.com/.auth/web/redirect' ` --output json) - # Retrieve AppId - if ($app) { - $appId = ($app | ConvertFrom-Json) | Select-Object -ExpandProperty appId - } - - if(-not $appId) { + if(-not $appJson) { Write-Host "! Could not provision Microsoft App Registration automatically. Review the log for more information." -ForegroundColor DarkRed Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed Write-Host "+ Provision an app manually in the Azure Portal, then try again providing the -appId and -appPassword arguments. See https://aka.ms/vamanualappcreation for more information." -ForegroundColor Magenta Break } + + $app = ($appJson | ConvertFrom-Json) +} else { + # Get the app registration + $appsJson = (az ad app list ` + --app-id $appId ` + --output json) + + $apps = ($appsJson | ConvertFrom-Json) + + if($apps.Length -eq 0) { + Write-Host "! Could not find appId $($appId). Review the log for more information." -ForegroundColor DarkRed + Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed + Break + } + + $app = $apps[0]; } +$appId = $app.appId + # Get timestamp $timestamp = Get-Date -f MMddyyyyHHmmss @@ -207,6 +223,9 @@ if ($outputs) # Deploy cognitive models Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisAccountRegion $($outputs.luis.value.region) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($srcDir)' -languages '$($languages)'" + # Update app registration homepage to point to skill + az ad app update --id $app.objectId --homepage "https://$($outputs.botWebAppName.value).azurewebsites.net" + # Summary Write-Host "Summary of the deployed resources:" -ForegroundColor Yellow