From 119864cea082fe39a4051941fc340e0b313174a2 Mon Sep 17 00:00:00 2001 From: hiyadav Date: Wed, 14 Dec 2016 14:52:28 +0530 Subject: [PATCH 1/2] azurecli classic cert auth's service url picked from endpoint --- Tasks/AzureCLI/azureclitask.ts | 7 ++++--- Tasks/AzureCLI/package.json | 2 +- Tasks/AzureCLI/task.json | 2 +- Tasks/AzureCLI/task.loc.json | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Tasks/AzureCLI/azureclitask.ts b/Tasks/AzureCLI/azureclitask.ts index 5698561825a6..961accd72834 100644 --- a/Tasks/AzureCLI/azureclitask.ts +++ b/Tasks/AzureCLI/azureclitask.ts @@ -130,8 +130,9 @@ export class azureclitask { if (endpointAuth.scheme === "Certificate") { var bytes = endpointAuth.parameters["certificate"]; var subscriptionId:string = tl.getEndpointDataParameter(connectedService, "SubscriptionId", true); + var serviceManagementUrl:string = tl.getEndpointUrl(connectedService, false); const publishSettingFileName:string = path.join(os.tmpdir() ,"subscriptions" + new Date().getTime() + ".publishsettings"); - this.createPublishSettingFile(subscriptionName, subscriptionId, bytes, publishSettingFileName); + this.createPublishSettingFile(subscriptionName, subscriptionId, bytes, serviceManagementUrl, publishSettingFileName); var resultOfToolExecution = tl.execSync("azure", "account import \"" + publishSettingFileName + "\""); this.deleteFile(publishSettingFileName); this.throwIfError(resultOfToolExecution); @@ -198,9 +199,9 @@ export class azureclitask { } } - private static createPublishSettingFile(subscriptionName:string, subscriptionId:string, certificate:string, publishSettingFileName:string): void { + private static createPublishSettingFile(subscriptionName:string, subscriptionId:string, certificate:string, serviceManagementUrl:string, publishSettingFileName:string): void { //writing the data to the publishsetting file - this.createFile(publishSettingFileName, util.format(' ',subscriptionId, subscriptionName, certificate)); + this.createFile(publishSettingFileName, util.format(' ',serviceManagementUrl, subscriptionId, subscriptionName, certificate)); } private static createFile (filePath:string, data:string) diff --git a/Tasks/AzureCLI/package.json b/Tasks/AzureCLI/package.json index fc034882caf0..df6c48efec94 100644 --- a/Tasks/AzureCLI/package.json +++ b/Tasks/AzureCLI/package.json @@ -1,6 +1,6 @@ { "name": "vsts-tasks-azurecli", - "version": "0.2.4", + "version": "0.2.6", "description": "VSTS Azure CLI Task", "main": "azureclitask.js", "scripts": { diff --git a/Tasks/AzureCLI/task.json b/Tasks/AzureCLI/task.json index 06de40fd23a8..f9e787d5fad4 100644 --- a/Tasks/AzureCLI/task.json +++ b/Tasks/AzureCLI/task.json @@ -18,7 +18,7 @@ "version": { "Major": 0, "Minor": 2, - "Patch": 5 + "Patch": 6 }, "minimumAgentVersion": "1.95.0", "instanceNameFormat": "Azure CLI $(scriptPath)", diff --git a/Tasks/AzureCLI/task.loc.json b/Tasks/AzureCLI/task.loc.json index d831e968810b..c4d81cbb77b3 100644 --- a/Tasks/AzureCLI/task.loc.json +++ b/Tasks/AzureCLI/task.loc.json @@ -18,7 +18,7 @@ "version": { "Major": 0, "Minor": 2, - "Patch": 5 + "Patch": 6 }, "minimumAgentVersion": "1.95.0", "instanceNameFormat": "ms-resource:loc.instanceNameFormat", From 86b8a8b377f15aae1cddbd515e39354989ecf851 Mon Sep 17 00:00:00 2001 From: hiyadav Date: Fri, 16 Dec 2016 09:40:20 +0530 Subject: [PATCH 2/2] changes in UT's for service url in Azure classic mode --- Tests/L0/AzureCLI/azureLoginFails.json | 5 +++-- Tests/L0/AzureCLI/azureclitaskPass.json | 1 + Tests/L0/AzureCLI/scriptExecutionFailed.json | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Tests/L0/AzureCLI/azureLoginFails.json b/Tests/L0/AzureCLI/azureLoginFails.json index ea6b8d5d547e..9fe20ca33044 100644 --- a/Tests/L0/AzureCLI/azureLoginFails.json +++ b/Tests/L0/AzureCLI/azureLoginFails.json @@ -45,9 +45,10 @@ "ENDPOINT_AUTH_AzureClassicFail": "{\"parameters\":{\"certificate\":\"cert\"},\"scheme\":\"Certificate\"}", "ENDPOINT_DATA_AzureClassicFail_SUBSCRIPTIONNAME": "sName", "ENDPOINT_DATA_AzureClassicFail_SUBSCRIPTIONID": "sId", + "ENDPOINT_URL_AzureClassicFail":"https://www.sampleServiceUrl.net/", "ENDPOINT_AUTH_AzureRM": "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}", "ENDPOINT_AUTH_AzureRMFail": "{\"parameters\":{\"serviceprincipalid\":\"idf\",\"serviceprincipalkey\":\"keyf\",\"tenantid\":\"tenantf\"},\"scheme\":\"ServicePrincipal\"}", "ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME": "sName", "ENDPOINT_DATA_AzureRMFail_SUBSCRIPTIONNAME": "sName" - } -} \ No newline at end of file +} + } \ No newline at end of file diff --git a/Tests/L0/AzureCLI/azureclitaskPass.json b/Tests/L0/AzureCLI/azureclitaskPass.json index 056f4af41ef6..bbe977a4a9d4 100644 --- a/Tests/L0/AzureCLI/azureclitaskPass.json +++ b/Tests/L0/AzureCLI/azureclitaskPass.json @@ -61,6 +61,7 @@ "ENDPOINT_AUTH_AzureClassic": "{\"parameters\":{\"certificate\":\"cert\"},\"scheme\":\"Certificate\"}", "ENDPOINT_DATA_AzureClassic_SUBSCRIPTIONNAME": "sName", "ENDPOINT_DATA_AzureClassic_SUBSCRIPTIONID": "sId", + "ENDPOINT_URL_AzureClassic":"https://www.sampleServiceUrl.net/", "ENDPOINT_AUTH_AzureRM": "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}", "ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME": "sName" } diff --git a/Tests/L0/AzureCLI/scriptExecutionFailed.json b/Tests/L0/AzureCLI/scriptExecutionFailed.json index 4bdec09f6773..b96dec442b38 100644 --- a/Tests/L0/AzureCLI/scriptExecutionFailed.json +++ b/Tests/L0/AzureCLI/scriptExecutionFailed.json @@ -11,7 +11,7 @@ "stdout":"bash execution failed", "stderr": "bash stderr" }, - "scriptfail.bat arg1": { + "scriptfail.bat arg1": { "code": 1, "stdout":"cmd execution failed", "stderr": "cmd stderr" @@ -60,6 +60,7 @@ "ENDPOINT_AUTH_AzureClassic": "{\"parameters\":{\"certificate\":\"cert\"},\"scheme\":\"Certificate\"}", "ENDPOINT_DATA_AzureClassic_SUBSCRIPTIONNAME": "sName", "ENDPOINT_DATA_AzureClassic_SUBSCRIPTIONID": "sId", + "ENDPOINT_URL_AzureClassic":"https://www.sampleServiceUrl.net/", "ENDPOINT_AUTH_AzureRM": "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}", "ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME": "sName" }