Azure-Player / azure.datafactory.tools

Tools for deploying Data Factory (v2) in Microsoft Azure
https://azureplayer.net/adftools
MIT License
207 stars 69 forks source link

`-RootFolder` must be absolute otherwise temp files cannot be written #335

Closed fmms closed 1 year ago

fmms commented 1 year ago

Describe the bug When I execute the script with a relative path in -RootFolder and -Stage execution breaks with the following error message:

===================================================================================
STEP: Pre-deployment
===================================================================================
STEP: Replacing all properties environment-related...
Config file:   .\deployment\prod.csv
Validation of config file completed.
Ausnahme beim Aufrufen von "WriteAllLines" mit 3 Argument(en):  "Ein Teil des Pfades "U:\linkedService\~ls_onPremDWH.json" konnte nicht gefunden werden."
In \\mnzfs100\Users-Ext$\xmoell46\WindowsPowerShell\Modules\azure.datafactory.tools\1.5.0\private\Save-AdfObjectAsFile.ps1:12 Zeichen:5
+     [IO.File]::WriteAllLines($newFileName, $output, $Utf8NoBomEncodin ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DirectoryNotFoundException

To Reproduce Your script to reproduce the behaviour:

Publish-AdfV2FromJson -RootFolder . -ResourceGroupName "rg-gamdwh-prod-001" -DataFactoryName "df-gamdwh-ingest-prod" -Location "West Europe" -Stage .\deployment\prod.csv

Expected behaviour I expect

Publish-AdfV2FromJson -RootFolder . -ResourceGroupName "rg-gamdwh-prod-001" -DataFactoryName "df-gamdwh-ingest-prod" -Location "West Europe" -Stage .\deployment\prod.csv

to behave the same as

Publish-AdfV2FromJson -RootFolder "C:\df-gamdwh-ingest-fm" -ResourceGroupName "rg-gamdwh-prod-001" -DataFactoryName "df-gamdwh-ingest-prod" -Location "West Europe" -Stage .\deployment\prod.csv

Screenshots If applicable, add screenshots to help explain your problem.

Version of PowerShell module of:

PS C:\df-gamdwh-ingest-fm> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.5582
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.5582
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\df-gamdwh-ingest-fm> Get-Module Azure.datafactory.tools

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.5.0      azure.datafactory.tools             {Export-AdfToArmTemplate, Get-AdfDocDiagram, Get-AdfFromService, Import-AdfFromFolder...}

Provide all files to reproduce the issue