diff --git a/BuildSSASTask/task.json b/BuildSSASTask/task.json index ca97b6b..043b7cd 100644 --- a/BuildSSASTask/task.json +++ b/BuildSSASTask/task.json @@ -17,7 +17,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 4 + "Patch": 6 }, "demands": [ ], "minimumAgentVersion": "1.95.0", diff --git a/DeploySSASTask/DeploySSASTask.ps1 b/DeploySSASTask/DeploySSASTask.ps1 index 79ec6fa..5e1722b 100644 --- a/DeploySSASTask/DeploySSASTask.ps1 +++ b/DeploySSASTask/DeploySSASTask.ps1 @@ -53,6 +53,7 @@ try { $OptimizationSettingsDeployment = Get-VstsInput -Name OptimizationSettingsDeployment -Require $WriteBackTableCreation = Get-VstsInput -Name WriteBackTableCreation -Require $mgmtVersion = Get-VstsInput -Name mgmtVersion -Require + $customMGMTVersion = Get-VstsInput -Name customMGMTVersion $ImpersonationInformation = Get-VstsInput -Name ImpersonationInformation -Require $ServiceAccountName = Get-VstsInput -Name ServiceAccountName $ServiceAccountPassword = Get-VstsInput -Name ServiceAccountPassword @@ -76,21 +77,44 @@ try { if (Test-Path("C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe")) { $compiler = "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe"} if (Test-Path("C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe")) { $compiler = "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe"} } + "custom" { + if (Test-Path($customMGMTVersion)) { + if ($customMGMTVersion.EndsWith(".exe","CurrentCultureIgnoreCase")) { + $compiler = $customMGMTVersion + } else { + if (!$customMGMTVersion.EndsWith('\')) { + $customMGMTVersion = $customMGMTVersion + '\' + } + $compiler = $customMGMTVersion + "Microsoft.AnalysisServices.Deployment.exe" + } + } + } } - if (!(Test-Path($compiler))) { - Write-Host "##vso[task.logissue type=error;]Cannot access compiler. Selected version: $mgmtVersion" - } else { - Write-Host ("Deployment executable version: $compiler") + try { + if (!(Test-Path($compiler))) { + if ($mgmtVersion -eq "custom") { + Write-Host "##vso[task.logissue type=error;] Cannot access compiler. Selected version: $mgmtVersion : $customMGMTVersion" + } else { + Write-Host "##vso[task.logissue type=error;] Cannot access compiler. Selected version: $mgmtVersion" + } + Exit 1 + } else { + Write-Host (Get-VstsLocString -key DeploymentExecutable0 -ArgumentList $compiler) } + } + catch { + Write-Error (Get-VstsLocString -key CompilerNotFound) + Exit 1 + } - if (Get-Module -ListAvailable -Name SqlServer) { - if (-not (Get-Module -Name "SqlServer")) { - # if module is not loaded - Import-Module "SqlServer" -DisableNameChecking - } - } else { - Write-Host "##vso[task.logissue type=error;]SqlServer Powershell module not installed" + if (Get-Module -ListAvailable -Name SqlServer) { + if (-not (Get-Module -Name "SqlServer")) { + # if module is not loaded + Import-Module "SqlServer" -DisableNameChecking } + } else { + Write-Host "##vso[task.logissue type=error;]SqlServer Powershell module not installed" + } if([System.Convert]::ToBoolean($ConfigurationSettingsDeployment)) { $ConfigurationSettingsDeployment = "Retain" diff --git a/DeploySSASTask/task.json b/DeploySSASTask/task.json index 56dce19..420c911 100644 --- a/DeploySSASTask/task.json +++ b/DeploySSASTask/task.json @@ -17,7 +17,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 4 + "Patch": 6 }, "demands": [], "minimumAgentVersion": "1.95.0", @@ -175,11 +175,21 @@ "2012": "2012", "2014": "2014", "2016": "2016", - "2017": "2017" + "2017": "2017", + "custom": "Custom deployment wizard location" + }, + "helpMarkDown": "Select Management Studio version on TFS Agent machines. Appropriate version of SQL Management Studio must be installed on agent! ", + "groupName": "options" }, - "helpMarkDown": "Select Management Studio version on TFS Agent machines. Appropriate version of SQL Management Studio must be installed on agent! ", - "groupName": "options" - } + { + "name": "customMGMTVersion", + "type": "string", + "label": "Custom Analysis Services Deployment executable path", + "defaultValue": "C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\ManagementStudio\\Microsoft.AnalysisServices.Deployment.exe", + "visibleRule": "mgmtVersion=custom", + "required": true, + "groupName": "options" + } ], "instanceNameFormat": "Deploy SSAS $(DatabaseName)", "execution": { @@ -200,6 +210,8 @@ "ErrorDuringDeployment": "Error(s) occurred while deploying database! See above error codes for details", "ErrorDuringProcessing": "Error(s) occurred while processing database! See above error codes for details", "InternalError0": "Task_InternalError {0}", - "EndingTask": "Ending DeploySSASTask" + "EndingTask": "Ending DeploySSASTask", + "CompilerNotFound": "No compiler could be found! Do you have SQL Server Management Studio installed on your agent?", + "DeploymentExecutable0": "Deployment executable version: {0}" } } diff --git a/README.md b/README.md index 8b79c47..f13b35c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ > while defining your release. You should enter this once your database has been deployed for the first time. You can specify to not overwrite these settings > for a next release. > NOTE: the deployment uses the Management Studio executable Microsoft.AnalysisServices.Deployment.exe Make sure that this is installed on your build agent! +> Currently the Microsoft Hosted Agents DO NOT have Management Studio installed, so deployement from these hosts is unsupported. Setup a self hosted agent with SQL +> Server Managenment Studio installed on it to use the deployment component > SECURITY WARNING: if you choose to use Windows username and password as impersonation mode the password you supply will be written in plaintext on disk at the deploy agent! ## Contribute @@ -39,6 +41,7 @@ > * Added documentation > * Upated to use fit in Azure piplines category > * Added ImpersonationInformation option None, to skip impersonation settings altogether +> * Custom Management Studio location (Microsoft.AnalysisServices.Deployment.exe) for deployment component ## TODO: > * a Lot! diff --git a/vss-extension.json b/vss-extension.json index 06500a3..527356f 100644 --- a/vss-extension.json +++ b/vss-extension.json @@ -1,7 +1,7 @@ { "manifestVersion": 1, "id": "VSTS-SSAS", - "version": "1.0.4", + "version": "1.0.6", "name": "SSAS Build & Deploy", "scopes": [ "vso.work", "vso.work_write" ], "description": "Extension with Continuous Integration support for SSAS",