diff --git a/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceGroupDeploymentV2/Strings/resources.resjson/en-US/resources.resjson index 4235150a614f..e827d5b0bb23 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": "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/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts b/Tasks/AzureResourceGroupDeploymentV2/operations/ResourceGroup.ts index f4456c7455a3..5f389febe162 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); + this.checkAndPrintPortalDeploymentURL(); return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -551,6 +553,10 @@ export class ResourceGroup { } } + protected checkAndPrintPortalDeploymentURL() { + 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); @@ -569,6 +575,18 @@ export class ResourceGroup { await this.performAzureDeployment(armClient, deployment, 3); } + 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 + "/resourceGroups/" + this.taskParameters.resourceGroupName + "/providers/Microsoft.Resources/deployments/" + this.taskParameters.deploymentName; + return portalUrl + subscriptionSpecificURL.replace(/\//g, '%2F'); + } catch (error) { + tl.error(error); + return error; + } + } + private escapeBlockCharacters(str: string): string { return str.replace(/[\[]/g, '$&[]'); } diff --git a/Tasks/AzureResourceGroupDeploymentV2/task.json b/Tasks/AzureResourceGroupDeploymentV2/task.json index feb2c86235a3..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", @@ -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": "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/AzureResourceGroupDeploymentV2/task.loc.json b/Tasks/AzureResourceGroupDeploymentV2/task.loc.json index 927c298f992b..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", @@ -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 diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson index bb4449642c71..c0a6996c5eed 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": "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 cea703730fec..6cb42e13f1e5 100644 --- a/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts +++ b/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/DeploymentScopeBase.ts @@ -54,6 +54,8 @@ export class DeploymentScopeBase { return this.waitAndPerformAzureDeployment(retryCount); } utils.writeDeploymentErrors(this.taskParameters, error); + this.checkAndPrintPortalDeploymentURL(); + return reject(tl.loc("CreateTemplateDeploymentFailed")); } if (result && result["properties"] && result["properties"]["outputs"] && utils.isNonEmpty(this.taskParameters.deploymentOutputs)) { @@ -68,6 +70,31 @@ export class DeploymentScopeBase { } } + protected checkAndPrintPortalDeploymentURL() { + if(this.taskParameters.deploymentScope == "Resource Group") { + tl.error(tl.loc("FindMoreDeploymentDetailsAzurePortal", this.getAzurePortalDeploymentURL())); + } + } + + 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 { return new Promise((resolve, reject) => { console.log(tl.loc("StartingValidation")); diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.json index c8b58e7e6c12..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": [], @@ -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": "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" } } diff --git a/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json b/Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json index e7b07e0c7928..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": [], @@ -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