Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.24k stars 3.84k forks source link

Template Spec with Relative Ancestor Path #16364

Open brianstringfellow opened 2 years ago

brianstringfellow commented 2 years ago

Description

@dingmeng-xue @dcaro From discussion: https://github.com/Azure/azure-powershell/discussions/16106

Is it possible to specify a templateLink with a relativePath that traverses the parent or further ancestor folders?

"templateLink": {
  "relativePath": "../Resources/resourceGroups.json",
  "contentVersion": "1.0.0.0"
},

The error message I see indicates it is not possible. "message": "The artifact path '..\\Resources\\resourceGroups.json' is not supported. Artifact paths cannot contain '..' or '.' relative path segments."

Yet, I saw an example used in the following issue that seems to imply it does work.

13998 (comment)

Also, I can see in the debug output that the Cmdlet does find and read the linked template because the HTTP PUT call is including the linked template in the body of the call. Perhaps there is some small detail that I am missing.

DEBUG: AzureQoSEvent: Module: Az.Resources:4.4.0; CommandName: New-AzTemplateSpec; PSVersion: 7.1.5;

Issue script & Debug output

"message": "The artifact path '..\\Resources\\resourceGroups.json' is not supported. Artifact paths cannot contain '..' or '.' relative path segments."

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.5
PSEdition                      Core
GitCommitId                    7.1.5
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.5.3                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefa…
Reso

Error output

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
dingmeng-xue commented 2 years ago

Thank you for your reporting. Tagging and routing to the team member best able to assist.

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

Issue Details
### Description @dingmeng-xue @dcaro From discussion: https://github.com/Azure/azure-powershell/discussions/16106 Is it possible to specify a templateLink with a relativePath that traverses the parent or further ancestor folders? ``` "templateLink": { "relativePath": "../Resources/resourceGroups.json", "contentVersion": "1.0.0.0" }, ``` The error message I see indicates it is not possible. `"message": "The artifact path '..\\Resources\\resourceGroups.json' is not supported. Artifact paths cannot contain '..' or '.' relative path segments."` Yet, I saw an example used in the following issue that seems to imply it does work. #13998 (comment) Also, I can see in the debug output that the Cmdlet does find and read the linked template because the HTTP PUT call is including the linked template in the body of the call. Perhaps there is some small detail that I am missing. DEBUG: AzureQoSEvent: Module: Az.Resources:4.4.0; CommandName: New-AzTemplateSpec; PSVersion: 7.1.5; ### Issue script & Debug output ```PowerShell "message": "The artifact path '..\\Resources\\resourceGroups.json' is not supported. Artifact paths cannot contain '..' or '.' relative path segments." ``` ### Environment data ```PowerShell Name Value ---- ----- PSVersion 7.1.5 PSEdition Core GitCommitId 7.1.5 OS Microsoft Windows 10.0.19043 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` ### Module versions ```PowerShell ModuleType Version PreRelease Name ExportedCommands ---------- ------- ---------- ---- ---------------- Script 2.5.3 Az.Accounts {Add-AzEnvironment, Clear-AzContext, Clear-AzDefa… Reso ``` ### Error output ```PowerShell The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR. ```
Author: brianstringfellow
Assignees: -
Labels: `Service Attention`, `bug`, `question`, `ARM - Templates`, `customer-reported`
Milestone: -
SaurabhSharma-MSFT commented 2 years ago

@armleads-azure Do you have any updates on this issue.