web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

retreiving the asset ID from previous Devops task

(1) ShareShare
ReportReport
Posted on by 90
Hi All,
 
i have a build pipeline that create a package and upload it to LCS and also deploy it to a cloud Dev in  the build pipeline.
my question how can i retreive as per below screen shot the asset id that was uploaded in previous step ?
 
 
I have the same question (0)
  • MDeeb Profile Picture
    90 on at
    retreiving the asset ID from previous Devops task

    Hi Martin,

    the previous screen shot i sent where no output variable is because the pipeline created is based as yml code template..

    i tried to create a new pipeline as an empty job instead of .yml template, and the option you mentioned of output variable is there .

    do you have any idea how can i add the output variable in the yml configuration ?

    also please if you may have any guides other than microsoft guides that states step by step how to configure the build pipeline using self hosted from scratch.

     

    below is the yml file that i am trying to add the output variable to it but not able to.

     

    # Sample YML pipeline for X++ builds
    # For more information on build pipelines, see
    # https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-tools/hosted-build-automation
    # Change the name of the build to a 4-digit version number to be used for model versioning
    name: $(Date:yy.MM.dd)$(Rev:.r)
    trigger:
    - staging
    pool:
    # Use the VS2019 image
      vmImage: 'windows-2019'
      demands:
        - msbuild
        - visualstudio
      
    # Declare some shorthand for NuGet package names
    # Make editing the path for metadata and NuGet extraction folder easier
    variables:
      AppPackage: 'Microsoft.Dynamics.AX.Application.DevALM.BuildXpp'
      AppSuitePackage: 'Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp'
      PlatPackage: 'Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp'
      ToolsPackage: 'Microsoft.Dynamics.AX.Platform.CompilerPackage'
      MetadataPath: '$(Build.SourcesDirectory)'
      NugetConfigsPath: '$(Build.SourcesDirectory)\Solution'
      NugetsPath: '$(Pipeline.Workspace)\NuGets'
    steps:
    # Install NuGet and use -ExcludeVersion option to avoid paths containing version numbers
    - task: NuGetInstaller@0
      displayName: 'NuGet install Packages'
      inputs:
        solution: '$(NugetConfigsPath)\packages.config'
        nugetConfigPath: '$(NugetConfigsPath)\nuget.config'
        restoreMode: install
        nuGetRestoreArgs: '-ExcludeVersion -OutputDirectory "$(NugetsPath)"'
        nuGetVersion: 4.0.0.2283
     
    # Use the custom build number y.m.d.rev as the model version
    # Default updates only VAR layer and above
    - task: XppUpdateModelVersion@0
      displayName: 'Update Model Version'
      inputs:
        XppSourcePath: '$(MetadataPath)'
        XppDescriptorSearch: '**\Descriptor\*.xml'
        XppLayer: '8'
        VersionNumber: '$(Build.BuildNumber)'
     
    # Build using MSBuild 16 (VS 2019)
    # Provide the needed paths, including semi-colon separated list of reference folders
    # /p:ReferenceFolder are metadata folders containing other (compiled) X++ packages that are referenced
    # /p:ReferencePath are folders containing non-X++ assemblies referenced (aside from one already in the output folder for the package)
    - task: VSBuild@1
      displayName: 'Build solution **\*.sln'
      inputs:
        solution: '**/*.sln'
        msbuildArgs: '/p:BuildTasksDirectory="$(NugetsPath)\$(ToolsPackage)\DevAlm" /p:MetadataDirectory="$(MetadataPath)" /p:FrameworkDirectory="$(NuGetsPath)\$(ToolsPackage)" /p:ReferenceFolder="$(NuGetsPath)\$(PlatPackage)\ref\net40;$(NuGetsPath)\$(AppPackage)\ref\net40;$(NuGetsPath)\$(AppSuitePackage)\ref\net40;$(MetadataPath);$(Build.BinariesDirectory)" /p:ReferencePath="$(NuGetsPath)\$(ToolsPackage)" /p:OutputDirectory="$(Build.BinariesDirectory)"'
        clean: true
     
    # Copy the compiler log files to the drop artifacts
    - task: CopyFiles@2
      displayName: 'Copy X++ Compile Log Files to: $(Build.ArtifactStagingDirectory)\Logs'
      inputs:
        SourceFolder: '$(Build.SourcesDirectory)'
        Contents: |
          **\Dynamics.AX.*.xppc.*
          **\Dynamics.AX.*.labelc.*
          **\Dynamics.AX.*.reportsc.*
        TargetFolder: '$(build.ArtifactStagingDirectory)\Logs'
      condition: succeededOrFailed()
     
    # For packaging we need NuGet installed, with a version <3.4.0
    - task: NuGetToolInstaller@0
      displayName: 'Use NuGet 3.3.0'
      inputs:
        versionSpec: 3.3.0
    - task: XppCreatePackage@0
      displayName: 'Create Deployable Package'
      inputs:
        XppToolsPath: '$(NuGetsPath)\$(ToolsPackage)'
        XppBinariesPath: '$(Build.BinariesDirectory)'
        DeployablePackagePath: '$(Build.ArtifactStagingDirectory)\D365-FO-Packeges-$(Build.BuildNumber).zip'
    - task: InstallMSALModule@1
     
    # Enable this task to add a license file to the package
    - task: XppAddLicenseToPackage@0
      displayName: 'Add Licenses to Deployable Package'
      enabled: false
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'
      inputs:
        PathtoPublish: '$(build.artifactstagingdirectory)'
      condition: succeededOrFailed()

    - task: LCSAssetUpload@1
      inputs:
        serviceConnectionName: 'Sanabil LCS Connection'
        projectId: '1594818'
        assetType: '10'
        assetPath: '$(Build.ArtifactStagingDirectory)\D365-FO-Packeges-$(Build.BuildNumber).zip'
        assetName: 'Sanabil-Package-$(Build.BuildNumber)'
     
    - task: LCSAssetDeploy@3
      inputs:
        serviceConnectionName: 'Sanabil LCS Connection'
        projectId: '1594818'
        environmentId: 'fcb2297c-77aa-4d32-b9c0-11999de5eea3'
        fileAssetId: '6aa987f9-b66d-4b52-934d-95428579a2bd'
        deploymentType: 'hq'
        releaseName: '$(Release.ReleaseName)'

     

    Thank you,

  • MDeeb Profile Picture
    90 on at
    retreiving the asset ID from previous Devops task
    Thanks Martin,
     
    this was implemented by other vendor before, and i am trying to update it.
     
  • Martin Dráb Profile Picture
    235,814 Most Valuable Professional on at
    retreiving the asset ID from previous Devops task
    I currently don't know what it looks this way to you. I'd need to know more about how you created the pipeline.
  • MDeeb Profile Picture
    90 on at
    retreiving the asset ID from previous Devops task
    Thanks Martin,
     
    i do not see output variable, do you mean the variables , and if so i need to add like below second screen shot ?
     
     
     
     
  • Verified answer
    Martin Dráb Profile Picture
    235,814 Most Valuable Professional on at
    retreiving the asset ID from previous Devops task
    Edit your pipeline definition, go to the upload task and look at Output Variables. You may already see Upload variable there. If not, add it. Then you'll be able to refer to $(Upload.FileAssetId).
     
    By the way, Azure DevOps uses release pipelines to deploy assets. Rather then doing it directly in the build, set up a release pipeline and let it run after a successful build.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans