Step-by-Step Guide to Updating or Creating Artifacts for a Hosted Pipeline
In this blog, we’ll walk you through the process of updating or creating artifacts for a hosted pipeline. Follow these steps carefully to ensure a seamless setup and deployment experience.
Step 1: Import NuGet Packages from LCS
- Log in to Lifecycle Services (LCS) and locate the NuGet package files for the required Dynamics version.
- Make sure to select only the PEAP version of the packages.
- Download the NuGet package files to the following directory
- C:\temp
(Import the NuGet packages files from LCS for that particular version.(Pick only PEAP version) )
Step 2: Configure DevOps Artifacts
- Navigate to DevOps Artifacts in your Azure DevOps project.
- If you are updating an existing feed, click on Connect to Feed.
- For creating a new feed, click on + Create Feed and configure it.
- Select NuGet.exe as the tool and download the executable file to
4. Click on NuGet.exe and Get the tool and download the exe file to C:\Temp folder
Step 3: Prepare the Scripts
To proceed, you’ll need two scripts. Before running these, adjust the file paths, feed names, and credentials as necessary.
Script 1: Add the Feed Source
Replace the placeholders with the appropriate values:
C:\Temp\NuGet\nuget.exe sources Add -Name "PU42" -Source "https://pkgs.dev.azure.com/<ProjectName>/D365FO/_packaging/PU42/nuget/v3/index.json" -Username "<YourUsername>" -Password "<YourAccessToken>"
Ex:
C:\Temp\NuGet\nuget.exe sources Add -Name "PU42" -Source "https://pkgs.dev.azure.com/Projectname/D365FO/_packaging/PU42/nuget/v3/index.json" -Username "mallikarjun.gudidevuni" -password "4b4nA99BAACAAAAABG3k8AAASAZDOk2Dh"
Azure DevOps → Artifacts → Feed → Connect to Feed → NuGet.exe
Script 2: Push NuGet Packages
Update the script with the feed URL, username, and local file paths:
Script 2:
$Token = "<YourAccessToken>"
$FeedURL = "https://pkgs.dev.azure.com/<ProjectName>/D365FO/_packaging/PU42/nuget/v3/index.json"
$UserName = "<YourUsername>"
$LocalFileApplicationSuiteBuild = "C:\Temp\NuGet\Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp.nupkg"
$LocalFileApplicationBuild1 = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Application1.DevALM.BuildXpp.nupkg"
$LocalFileApplicationBuild2 = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Application2.DevALM.BuildXpp.nupkg"
$LocalFilePlatformBuild = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg"
$LocalFileCompilerTools = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Platform.CompilerPackage.nupkg"
C:\Temp\NuGet\nuget.exe sources push -Name "PU42" -Source $FeedURL -UserName $Token -Password $Token
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationSuiteBuild -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationBuild1 -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationBuild2 -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFilePlatformBuild -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileCompilerTools -Timeout 3000
Key Notes:
- Replace
<YourAccessToken>
with your DevOps-generated token. - Ensure all NuGet package file paths match the downloaded files in
C:\Temp\NuGet
.
$Token = "4b4nAY4sgyi1g8z4h6Wva1kWtTl0799BAACAASAZDOk2Dh"
$FeedURL = "https://pkgs.dev.azure.com/Projectanme/D365FO/_packaging/PU42/nuget/v3/index.json"
$UserName = "mallikarjun.gudidevuni"
$LocalFileApplicationSuiteBuild = "C:\Temp\NuGet\Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp.nupkg"
#$LocalFileApplicationBuild = "C:\_Columbus\NuGetPackages\Microsoft.Dynamics.AX.Application.DevALM.BuildXpp.nupkg"
$LocalFileApplicationBuild1 = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Application1.DevALM.BuildXpp.nupkg"
$LocalFileApplicationBuild2 = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Application2.DevALM.BuildXpp.nupkg"
$LocalFilePlatformBuild = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg"
$LocalFileCompilerTools = "C:\Temp\NuGet\Microsoft.Dynamics.AX.Platform.CompilerPackage.nupkg"
C:\Temp\NuGet\nuget.exe sources push -Name "PU42" -Source $FeedURL -UserName $Token -Password $Token
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationSuiteBuild -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationBuild1 -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileApplicationBuild2 -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFilePlatformBuild -Timeout 3000
C:\Temp\NuGet\nuget.exe push -Source "PU42" -ApiKey Az $LocalFileCompilerTools -Timeout 3000 ---------------------------------------------------------------------------------------------------------------
Step 4: Update Artifacts in TFS
- After executing the above scripts, verify that the artifacts have been successfully updated in your feed.
- Copy the updated artifact version.
- Update the version details in TFS to reflect the changes.
Conclusion
Following these steps ensures your artifacts are updated or created in a hosted pipeline with proper configurations. Always ensure you are using the correct credentials, feed names, and paths to avoid errors during deployment.
Feel free to leave any questions or feedback in the comments!