diff --git a/src/Commands/ConvertFromArmTemplateCommand.cs b/src/Commands/ConvertFromArmTemplateCommand.cs index 335210d..efc24d2 100644 --- a/src/Commands/ConvertFromArmTemplateCommand.cs +++ b/src/Commands/ConvertFromArmTemplateCommand.cs @@ -6,6 +6,7 @@ using PSArm.Serialization; using PSArm.Templates; using System; +using System.Collections.ObjectModel; using System.Management.Automation; namespace PSArm.Commands @@ -49,9 +50,13 @@ protected override void ProcessRecord() return; case "Path": + ProviderInfo provider = null; foreach (string path in Path) { - WriteObject(_parser.ParseFile(path)); + foreach (string resolvedPath in SessionState.Path.GetResolvedProviderPathFromPSPath(path, out provider)) + { + WriteObject(_parser.ParseFile(resolvedPath)); + } } return; diff --git a/test/pester/Conversion.Tests.ps1 b/test/pester/Conversion.Tests.ps1 index 75f2b0b..802a662 100644 --- a/test/pester/Conversion.Tests.ps1 +++ b/test/pester/Conversion.Tests.ps1 @@ -20,4 +20,14 @@ Describe "ARM conversion cmdlets" { Assert-StructurallyEqual -ComparisonObject $original -JsonObject $created } + + It 'Can accept relative path' { + try { + Push-Location "$PSScriptRoot/assets" + ConvertFrom-ArmTemplate -Path ./roundtrip-template.json | Should -Not -BeNullOrEmpty + } + finally { + Pop-Location + } + } }