Modules/AzureDevOpsDsc.Common/Resources/Functions/Public/AzDoPipelinePermission/New-AzDoPipelinePermission.ps1
|
Function New-AzDoPipelinePermission { [CmdletBinding()] param ( [Parameter(Mandatory = $true)][string]$ProjectName, [Parameter(Mandatory = $true)][string]$PipelineName, [Parameter(Mandatory = $true)][string]$GroupName, [Parameter(Mandatory = $true)][bool]$isInherited, [Parameter()][HashTable[]]$Permissions, [Parameter()][HashTable]$LookupResult, [Parameter()][Ensure]$Ensure, [Parameter()][System.Management.Automation.SwitchParameter]$Force ) Write-Verbose "[New-AzDoPipelinePermission] Started." $SecurityNamespace = Get-CacheItem -Key 'Build' -Type 'SecurityNamespaces' $Project = Get-CacheItem -Key $ProjectName -Type 'LiveProjects' if ((-not $SecurityNamespace) -or (-not $Project)) { Write-Error "[New-AzDoPipelinePermission] Security namespace or project not found." -ErrorAction Continue return } $serializeACLParams = @{ ReferenceACLs = $LookupResult.propertiesChanged DescriptorACLList = Get-CacheItem -Key $SecurityNamespace.namespaceId -Type 'LiveACLList' DescriptorMatchToken = ($LocalizedDataAzSerializationPatten.BuildPermission -f $Project.id) } $params = @{ OrganizationName = (Get-AzDoOrganizationName) SecurityNamespaceID = $SecurityNamespace.namespaceId SerializedACLs = ConvertTo-ACLHashtable @serializeACLParams } Set-AzDoPermission @params } |