Skip to content

Commit 7237bcc

Browse files
gavinbarronCopilotramsessanchez
authored
Install SDK modules from the CFS central package feed (#3666)
Installs the Microsoft.Graph[.Beta] modules from the PowerShell_V2_Build Azure Artifacts feed instead of PSGallery (network isolation / CFS compliance). Requires a pipeline run to validate. Copilot-Session: 9bd6fe40-0d69-4e3f-927b-8628c0ab6d34 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Ramses Sanchez-Hernandez <63934382+ramsessanchez@users.noreply.github.com>
1 parent ceb3630 commit 7237bcc

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.azure-pipelines/common-templates/install-sdk.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ steps:
55
targetType: 'inline'
66
pwsh: true
77
script: |
8+
# Register the central CFS feed (network-isolation compliance) and install the SDK modules from it.
9+
$token = ConvertTo-SecureString "$env:SYSTEM_ACCESSTOKEN" -AsPlainText -Force
10+
$cred = [System.Management.Automation.PSCredential]::new("azure", $token)
11+
$feedUrl = "https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/PowerShell_V2_Build/nuget/v2"
12+
if (-not (Get-PSRepository -Name PowerShell_V2_Build -ErrorAction SilentlyContinue)) {
13+
Register-PSRepository -Name PowerShell_V2_Build -SourceLocation $feedUrl -InstallationPolicy Trusted -Credential $cred
14+
}
815
try{
916
# Installing Beta module.
10-
Install-Module Microsoft.Graph.Beta -Repository PSGallery -Scope AllUsers -AcceptLicense -SkipPublisherCheck -Force -AllowClobber
17+
Install-Module Microsoft.Graph.Beta -Repository PowerShell_V2_Build -Credential $cred -Scope AllUsers -AcceptLicense -SkipPublisherCheck -Force -AllowClobber
1118
}catch{
1219
echo "Error when installing Beta"
1320
}
1421
try{
1522
# Installing V1 module.
16-
Install-Module Microsoft.Graph -Repository PSGallery -Scope AllUsers -AcceptLicense -SkipPublisherCheck -Force -AllowClobber
23+
Install-Module Microsoft.Graph -Repository PowerShell_V2_Build -Credential $cred -Scope AllUsers -AcceptLicense -SkipPublisherCheck -Force -AllowClobber
1724
}catch{
1825
echo "Error when installing V1"
19-
}
26+
}
27+
env:
28+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)

0 commit comments

Comments
 (0)