Skip to content

Commit 7557cf0

Browse files
committed
feat: Add Set-AzDoPAT function
Add Set-AzDoPAT function to set header variable with a PAT
1 parent 0747d5c commit 7557cf0

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function Set-AzDoPAT {
2+
<#
3+
.SYNOPSIS
4+
This script sets the header variable with a PAT.
5+
.DESCRIPTION
6+
This script sets the header variable with a PAT.
7+
.NOTES
8+
This function can be used to use a PAT for authentication instead of an Azure PowerShell access token.
9+
.EXAMPLE
10+
Set-AzDoPAT -Pat '***'
11+
12+
This example sets the header variable used for authentication with a PAT.
13+
#>
14+
[CmdletBinding(SupportsShouldProcess)]
15+
param (
16+
# PAT used for authentication
17+
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
18+
[string]
19+
$Pat
20+
)
21+
22+
process {
23+
if ($PSCmdlet.ShouldProcess()) {
24+
New-AzDoAuthHeader -Pat $Pat
25+
} else {
26+
Write-Verbose "Calling New-AzDoAuthHeader with pat"
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)