我在将角色分配给存储容器 rwx 时面临一个问题,以便我的数据工厂可以从 adls gen 2 读取数据。下面的脚本在 azure devops powershell 脚本中使用内联脚本运行良好。但是当我将其更改为来自文件路径的脚本时(位置是github)。我已经在 .ps1 扩展名中放入了以下脚本。
[CmdletBinding()]
param(
[parameter(Mandatory = $false)] [String] $resourcegroup_name,
[parameter(Mandatory = $false)] [String] $factoryName,
[parameter(Mandatory = $false)] [String] $storageaccount_name
)
$principalID = (Get-AzDataFactoryV2 -ResourceGroupName $resourcegroup_name -Name
$factoryName).identity.PrincipalId
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourcegroup_name -AccountName
$storageaccount_name
$ctx = $storageAccount.Context
$filesystemName = "adftransformation"
$dirname = "mfg/"
$dir = New-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path $dirname -Directory -
Permission r-x -Umask ---rwx--- -Property @{"ContentEncoding" = "UDF8"; "CacheControl" = "READ"}
$acl = (Get-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path $dirname).ACL
$acl = set-AzDataLakeGen2ItemAclObject -AccessControlType user -EntityID $principalID -Permission r-x
-InputObject $acl
Update-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path $dirname -Acl $acl
我在 devops 管道中遇到的错误
2020-06-03T14:29:18.8399468Z ##[错误]无法验证参数“权限”的参数。参数“rx”与“([r-][w-][x-]){3}”模式不匹配。提供与“([r-] [w-][x-]){3}”匹配的参数并再次尝试该命令。
我不确定为什么在选择脚本作为文件路径时会发生这种情况,相同的脚本在内联脚本路径中运行良好