From 921a5ae6abe9fe2a26b087cf3c3ec7b5344761eb Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Wed, 27 Nov 2019 15:07:22 +0530 Subject: [PATCH 01/13] Init --- .../operations/DeploymentScopeBase.ts | 5 +++++ Tasks/AzureResourceManagerTemplateDeploymentV3/task.json | 2 +- Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index cea703730fec..e9f04b069832 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,6 +54,7 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); + tl.loc("Find more details about the deployment at: https://portal.azure.com/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/" + this.getUrlEncodedString("subscriptions/c00d16c7-6c1f-4c03-9be1-6934a4c49682/resourceGroups/issacnitinrg/providers/Microsoft.Resources/deployments/PolicyDeployment_6514630291545473334")); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -68,6 +69,10 @@ export class DeploymentScopeBase { } } + private getUrlEncodedString(url: string) { + return url.replace('/', '%2F'); + } + protected validateDeployment(): Promise { return new Promise((resolve, reject) => { console.log(tl.loc("StartingValidation")); diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index 967fe4c5d4b4..c8b58e7e6c12 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -15,7 +15,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 4 + "Patch": 5 }, "preview": "true", "demands": [], diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json index 9bb806e03ec4..e7b07e0c7928 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json @@ -15,7 +15,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 4 + "Patch": 5 }, "preview": "true", "demands": [], From c22fddbc622e3bdd469e73c1534a53305b3bfdb7 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Wed, 27 Nov 2019 16:11:27 +0530 Subject: [PATCH 02/13] Refactoring --- .../Strings/resources.resjson/en-US/resources.resjson | 3 ++- .../operations/DeploymentScopeBase.ts | 10 +++++++--- .../AzureResourceManagerTemplateDeploymentV3/task.json | 3 ++- .../task.loc.json | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson index bb4449642c71..60006e11a4cf 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson @@ -82,5 +82,6 @@ "loc.messages.ResourceGroupNameNotProvided": "Resource Group name should be provided", "loc.messages.LocationNotProvided": "Location is required for deployment", "loc.messages.ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", - "loc.messages.CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope" + "loc.messages.CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", + "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: %s" } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index e9f04b069832..afb519013c7f 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,7 +54,7 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); - tl.loc("Find more details about the deployment at: https://portal.azure.com/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/" + this.getUrlEncodedString("subscriptions/c00d16c7-6c1f-4c03-9be1-6934a4c49682/resourceGroups/issacnitinrg/providers/Microsoft.Resources/deployments/PolicyDeployment_6514630291545473334")); + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -69,8 +69,12 @@ export class DeploymentScopeBase { } } - private getUrlEncodedString(url: string) { - return url.replace('/', '%2F'); + private getAzurePortalDeploymentURL() { + let portalUrl = this.taskParameters.endpointPortalUrl ? this.taskParameters.endpointPortalUrl : "https://portal.azure.com"; + portalUrl += "/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/"; + + let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId + "/resourceGroups/" + this.taskParameters.resourceGroupName + "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); } protected validateDeployment(): Promise { diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index c8b58e7e6c12..58de0e455ecd 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -301,6 +301,7 @@ "ResourceGroupNameNotProvided": "Resource Group name should be provided", "LocationNotProvided": "Location is required for deployment", "ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", - "CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope" + "CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", + "FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: %s" } } diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json index e7b07e0c7928..532eb043e41a 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json @@ -301,6 +301,7 @@ "ResourceGroupNameNotProvided": "ms-resource:loc.messages.ResourceGroupNameNotProvided", "LocationNotProvided": "ms-resource:loc.messages.LocationNotProvided", "ARMServiceConnectionScope": "ms-resource:loc.messages.ARMServiceConnectionScope", - "CompleteDeploymentModeNotSupported": "ms-resource:loc.messages.CompleteDeploymentModeNotSupported" + "CompleteDeploymentModeNotSupported": "ms-resource:loc.messages.CompleteDeploymentModeNotSupported", + "FindMoreDeploymentDetailsAzurePortal": "ms-resource:loc.messages.FindMoreDeploymentDetailsAzurePortal" } } \ No newline at end of file From e7b7c35dc1baf80b189ec7b91bdb2d5a0b93163c Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Fri, 29 Nov 2019 17:16:05 +0530 Subject: [PATCH 03/13] Update Tasks/AzureResourceManagerTemplateDeploymentV3/task.json Co-Authored-By: Bishal Prasad --- Tasks/AzureResourceManagerTemplateDeploymentV3/task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index 58de0e455ecd..74b8e93cc845 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -302,6 +302,6 @@ "LocationNotProvided": "Location is required for deployment", "ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", "CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", - "FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: %s" + "FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: %s" } } From 785c0948657ab150fcac489e60b469f5f7f81c50 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Tue, 3 Dec 2019 15:56:34 +0530 Subject: [PATCH 04/13] Adding functionality for AzureResourceGroupDeploymentV2 --- .../Strings/resources.resjson/en-US/resources.resjson | 3 ++- .../operations/ResourceGroup.ts | 10 ++++++++++ Tasks/AzureResourceGroupDeploymentV2/task.json | 5 +++-- Tasks/AzureResourceGroupDeploymentV2/task.loc.json | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson index 4235150a614f..128bc5e0f3e3 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson @@ -191,5 +191,6 @@ "loc.messages.LogDeploymentName": "Deployment name is %s", "loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.", "loc.messages.DeploymentGroupConfigurationNotSucceeded": "Deployment group configuration did not succeed on one or more Virtual Machine(s): %s", - "loc.messages.DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s" + "loc.messages.DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s", + "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: %s" } \ No newline at end of file diff --git a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts index efd1f1bb36b3..1d2ad36a4baa 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts +++ b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts @@ -514,6 +514,7 @@ export class ResourceGroup { } if (result.error) { this.writeDeploymentErrors(result.error); + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); return reject(tl.loc("CreateTemplateDeploymentFailed")); } else { console.log(tl.loc("ValidDeployment")); @@ -537,6 +538,7 @@ export class ResourceGroup { return this.waitAndPerformAzureDeployment(armClient, deployment, retryCount); } this.writeDeploymentErrors(error); + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -569,6 +571,14 @@ export class ResourceGroup { await this.performAzureDeployment(armClient, deployment, 3); } + private getAzurePortalDeploymentURL() { + let portalUrl = this.taskParameters.endpointPortalUrl ? this.taskParameters.endpointPortalUrl : "https://portal.azure.com"; + portalUrl += "/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/"; + + let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId + "/resourceGroups/" + this.taskParameters.resourceGroupName + "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); + } + private enablePrereqDG = "ConfigureVMWithDGAgent"; private enablePrereqWinRM = "ConfigureVMwithWinRM"; private enablePrereqNone = "None"; diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.json b/Tasks/AzureResourceGroupDeploymentV2/task.json index 4e6ff31fa6b7..94366829633c 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.json @@ -15,7 +15,7 @@ "version": { "Major": 2, "Minor": 157, - "Patch": 7 + "Patch": 8 }, "demands": [], "minimumAgentVersion": "2.119.1", @@ -480,6 +480,7 @@ "LogDeploymentName": "Deployment name is %s", "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.", "DeploymentGroupConfigurationNotSucceeded": "Deployment group configuration did not succeed on one or more Virtual Machine(s): %s", - "DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s" + "DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s", + "FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: %s" } } \ No newline at end of file diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.loc.json b/Tasks/AzureResourceGroupDeploymentV2/task.loc.json index b220da0d16ac..478e7595abba 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.loc.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.loc.json @@ -15,7 +15,7 @@ "version": { "Major": 2, "Minor": 157, - "Patch": 7 + "Patch": 8 }, "demands": [], "minimumAgentVersion": "2.119.1", @@ -480,6 +480,7 @@ "LogDeploymentName": "ms-resource:loc.messages.LogDeploymentName", "ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal", "DeploymentGroupConfigurationNotSucceeded": "ms-resource:loc.messages.DeploymentGroupConfigurationNotSucceeded", - "DeploymentGroupConfigurationFailedOnVM": "ms-resource:loc.messages.DeploymentGroupConfigurationFailedOnVM" + "DeploymentGroupConfigurationFailedOnVM": "ms-resource:loc.messages.DeploymentGroupConfigurationFailedOnVM", + "FindMoreDeploymentDetailsAzurePortal": "ms-resource:loc.messages.FindMoreDeploymentDetailsAzurePortal" } } \ No newline at end of file From 0c0ee93f37e064062935b4e69e5a6fd602dd11c7 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Tue, 3 Dec 2019 16:03:46 +0530 Subject: [PATCH 05/13] Updating error message --- Tasks/AzureResourceGroupDeploymentV2/task.json | 2 +- Tasks/AzureResourceManagerTemplateDeploymentV3/task.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.json b/Tasks/AzureResourceGroupDeploymentV2/task.json index 94366829633c..067435dea644 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.json @@ -481,6 +481,6 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.", "DeploymentGroupConfigurationNotSucceeded": "Deployment group configuration did not succeed on one or more Virtual Machine(s): %s", "DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s", - "FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: %s" + "FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: (Please Copy-Paste the link) %s" } } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index 58de0e455ecd..c01bbb9ee27b 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -302,6 +302,6 @@ "LocationNotProvided": "Location is required for deployment", "ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", "CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", - "FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: %s" + "FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: (Please Copy-Paste the link) %s" } } From abd1361d746fcd0f61b1262e16663d4094012554 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Tue, 3 Dec 2019 16:53:01 +0530 Subject: [PATCH 06/13] Handling deploymentScope as Resource Group --- .../Strings/resources.resjson/en-US/resources.resjson | 2 +- .../operations/DeploymentScopeBase.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson index 60006e11a4cf..1168e7a43c06 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson @@ -83,5 +83,5 @@ "loc.messages.LocationNotProvided": "Location is required for deployment", "loc.messages.ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", "loc.messages.CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", - "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: %s" + "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: (Please Copy-Paste the link) %s" } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index afb519013c7f..31c13fe01e99 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -73,7 +73,13 @@ export class DeploymentScopeBase { let portalUrl = this.taskParameters.endpointPortalUrl ? this.taskParameters.endpointPortalUrl : "https://portal.azure.com"; portalUrl += "/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/"; - let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId + "/resourceGroups/" + this.taskParameters.resourceGroupName + "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId; + if(this.taskParameters.deploymentScope == "Resource Group") { + subscriptionSpecificURL += "/resourceGroups/" + this.taskParameters.resourceGroupName; + } + + subscriptionSpecificURL += "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); } From 689807b7164342cb56ff99607d208c8e6bbc628f Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Tue, 3 Dec 2019 17:43:04 +0530 Subject: [PATCH 07/13] Handling management group --- .../operations/DeploymentScopeBase.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index 31c13fe01e99..d9a8595b517e 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,7 +54,9 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + } return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { From 312665d0074b9db99c3b7c25c847108c2d5b17da Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Tue, 3 Dec 2019 17:47:03 +0530 Subject: [PATCH 08/13] Updating message --- Tasks/AzureResourceGroupDeploymentV2/task.json | 2 +- Tasks/AzureResourceManagerTemplateDeploymentV3/task.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.json b/Tasks/AzureResourceGroupDeploymentV2/task.json index 067435dea644..8aa33ac872e9 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.json @@ -481,6 +481,6 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.", "DeploymentGroupConfigurationNotSucceeded": "Deployment group configuration did not succeed on one or more Virtual Machine(s): %s", "DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s", - "FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: (Please Copy-Paste the link) %s" + "FindMoreDeploymentDetailsAzurePortal": "Task successfully created an Azure Resource Manager deployment, but the deployment failed. Please see more detailed Azure resource manager deployment logs at: (Please Copy-Paste the link) %s" } } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index c01bbb9ee27b..7a74d489419e 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -302,6 +302,6 @@ "LocationNotProvided": "Location is required for deployment", "ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", "CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", - "FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: (Please Copy-Paste the link) %s" + "FindMoreDeploymentDetailsAzurePortal": "Task successfully created an Azure Resource Manager deployment, but the deployment failed. Please see more detailed Azure resource manager deployment logs at: (Please Copy-Paste the link) %s" } } From 37b1818ae0fa24bb7a745a8f90839f05c6510cc6 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Wed, 4 Dec 2019 11:52:42 +0530 Subject: [PATCH 09/13] Review comments --- .../resources.resjson/en-US/resources.resjson | 2 +- .../resources.resjson/en-US/resources.resjson | 2 +- .../operations/DeploymentScopeBase.ts | 35 ++++++++++++------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson index 128bc5e0f3e3..e827d5b0bb23 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson @@ -192,5 +192,5 @@ "loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.", "loc.messages.DeploymentGroupConfigurationNotSucceeded": "Deployment group configuration did not succeed on one or more Virtual Machine(s): %s", "loc.messages.DeploymentGroupConfigurationFailedOnVM": "Failure for Virtual Machine '%s': %s", - "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about your deployment at: %s" + "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Task successfully created an Azure Resource Manager deployment, but the deployment failed. Please see more detailed Azure resource manager deployment logs at: (Please Copy-Paste the link) %s" } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson index 1168e7a43c06..c0a6996c5eed 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson @@ -83,5 +83,5 @@ "loc.messages.LocationNotProvided": "Location is required for deployment", "loc.messages.ARMServiceConnectionScope": "ARM Service Conection deployment scope - %s", "loc.messages.CompleteDeploymentModeNotSupported": "Deployment mode 'Complete' is not supported for deployment at '%s' scope", - "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Find more details about the Azure deployment at: (Please Copy-Paste the link) %s" + "loc.messages.FindMoreDeploymentDetailsAzurePortal": "Task successfully created an Azure Resource Manager deployment, but the deployment failed. Please see more detailed Azure resource manager deployment logs at: (Please Copy-Paste the link) %s" } \ No newline at end of file diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index d9a8595b517e..88744dd767d9 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,9 +54,7 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); - if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); - } + this.checkAndPrintPortalDeploymentURL(); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -71,18 +69,29 @@ export class DeploymentScopeBase { } } - private getAzurePortalDeploymentURL() { - let portalUrl = this.taskParameters.endpointPortalUrl ? this.taskParameters.endpointPortalUrl : "https://portal.azure.com"; - portalUrl += "/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/"; - - let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId; - if(this.taskParameters.deploymentScope == "Resource Group") { - subscriptionSpecificURL += "/resourceGroups/" + this.taskParameters.resourceGroupName; + protected checkAndPrintPortalDeploymentURL() { + if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); } + } - subscriptionSpecificURL += "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; - - return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); + private getAzurePortalDeploymentURL() { + try { + let portalUrl = this.taskParameters.endpointPortalUrl ? this.taskParameters.endpointPortalUrl : "https://portal.azure.com"; + portalUrl += "/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/"; + + let subscriptionSpecificURL = "/subscriptions/" + this.taskParameters.subscriptionId; + if(this.taskParameters.deploymentScope == "Resource Group") { + subscriptionSpecificURL += "/resourceGroups/" + this.taskParameters.resourceGroupName; + } + + subscriptionSpecificURL += "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + + return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); + } catch (error) { + tl.error(error); + return error; + } } protected validateDeployment(): Promise { From fe3b2d63cdbb3a02a98ca314aea2d0a413501a52 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Thu, 5 Dec 2019 15:25:34 +0530 Subject: [PATCH 10/13] Updating task version --- Tasks/AzureResourceGroupDeploymentV2/task.json | 2 +- Tasks/AzureResourceGroupDeploymentV2/task.loc.json | 2 +- Tasks/AzureResourceManagerTemplateDeploymentV3/task.json | 2 +- Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.json b/Tasks/AzureResourceGroupDeploymentV2/task.json index 8aa33ac872e9..0bdc29e93040 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.json @@ -15,7 +15,7 @@ "version": { "Major": 2, "Minor": 157, - "Patch": 8 + "Patch": 10 }, "demands": [], "minimumAgentVersion": "2.119.1", diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.loc.json b/Tasks/AzureResourceGroupDeploymentV2/task.loc.json index 478e7595abba..8650ca8fbe7f 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/task.loc.json +++ b/Tasks/AzureResourceGroupDeploymentV2/task.loc.json @@ -15,7 +15,7 @@ "version": { "Major": 2, "Minor": 157, - "Patch": 8 + "Patch": 10 }, "demands": [], "minimumAgentVersion": "2.119.1", diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index 7a74d489419e..c0c84f25e99d 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json @@ -15,7 +15,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 5 + "Patch": 7 }, "preview": "true", "demands": [], diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json index 532eb043e41a..4a2a66b1df1e 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json @@ -15,7 +15,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 5 + "Patch": 7 }, "preview": "true", "demands": [], From 3ab7bfb95bcb1868abd25c50c179a36aa36dcf3d Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Thu, 5 Dec 2019 15:34:11 +0530 Subject: [PATCH 11/13] Bug fix --- .../operations/ResourceGroup.ts | 8 +++++++- .../operations/DeploymentScopeBase.ts | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts index d2520eeb01ed..33838102f10d 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts +++ b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts @@ -538,7 +538,7 @@ export class ResourceGroup { return this.waitAndPerformAzureDeployment(armClient, deployment, retryCount); } this.writeDeploymentErrors(error); - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + this.checkAndPrintPortalDeploymentURL(error); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -553,6 +553,12 @@ export class ResourceGroup { } } + protected checkAndPrintPortalDeploymentURL(error: any) { + if(!!error && (error.statusCode == 200 || error.statusCode == 201)) { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + } + } + private async waitAndPerformAzureDeployment(armClient: armResource.ResourceManagementClient, deployment: Deployment, retryCount): Promise { await sleepFor(3); return this.performAzureDeployment(armClient, deployment, retryCount - 1); diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index 88744dd767d9..9f3b392f0e6a 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,7 +54,8 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); - this.checkAndPrintPortalDeploymentURL(); + this.checkAndPrintPortalDeploymentURL(error); + return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -69,9 +70,11 @@ export class DeploymentScopeBase { } } - protected checkAndPrintPortalDeploymentURL() { - if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + protected checkAndPrintPortalDeploymentURL(error: any) { + if(!!error && (error.statusCode == 200 || error.statusCode == 201)) { + if(this.taskParameters.deploymentScope == "Resource Group") { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + } } } From 8b4ba6d22837f72362fb4c4034bd6084d11d2a27 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Thu, 5 Dec 2019 16:16:45 +0530 Subject: [PATCH 12/13] Print log for subscription as well --- .../operations/DeploymentScopeBase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index 9f3b392f0e6a..3dfd85329a0f 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -72,7 +72,7 @@ export class DeploymentScopeBase { protected checkAndPrintPortalDeploymentURL(error: any) { if(!!error && (error.statusCode == 200 || error.statusCode == 201)) { - if(this.taskParameters.deploymentScope == "Resource Group") { + if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); } } From 13f5ab08ae5e40f8514c2ba310a9eaed13835ba1 Mon Sep 17 00:00:00 2001 From: Nitin Issac Joy Date: Thu, 5 Dec 2019 16:29:25 +0530 Subject: [PATCH 13/13] Bug fix --- .../operations/ResourceGroup.ts | 8 +++----- .../operations/DeploymentScopeBase.ts | 10 ++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts index 33838102f10d..5f389febe162 100644 --- a/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts +++ b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts @@ -538,7 +538,7 @@ export class ResourceGroup { return this.waitAndPerformAzureDeployment(armClient, deployment, retryCount); } this.writeDeploymentErrors(error); - this.checkAndPrintPortalDeploymentURL(error); + this.checkAndPrintPortalDeploymentURL(); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -553,10 +553,8 @@ export class ResourceGroup { } } - protected checkAndPrintPortalDeploymentURL(error: any) { - if(!!error && (error.statusCode == 200 || error.statusCode == 201)) { - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); - } + protected checkAndPrintPortalDeploymentURL() { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); } private async waitAndPerformAzureDeployment(armClient: armResource.ResourceManagementClient, deployment: Deployment, retryCount): Promise { diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts index 3dfd85329a0f..6cb42e13f1e5 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,7 +54,7 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); - this.checkAndPrintPortalDeploymentURL(error); + this.checkAndPrintPortalDeploymentURL(); return reject(tl.loc("CreateTemplateDeploymentFailed")); } @@ -70,11 +70,9 @@ export class DeploymentScopeBase { } } - protected checkAndPrintPortalDeploymentURL(error: any) { - if(!!error && (error.statusCode == 200 || error.statusCode == 201)) { - if(this.taskParameters.deploymentScope == "Resource Group" || this.taskParameters.deploymentScope == "Subscription") { - tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); - } + protected checkAndPrintPortalDeploymentURL() { + if(this.taskParameters.deploymentScope == "Resource Group") { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); } }