Azure / azure-devtestlab

Azure DevTestLab artifacts, scripts and samples
MIT License
458 stars 602 forks source link

Add windows-download-artifacts-drop artifact #889

Closed bradselw closed 5 months ago

bradselw commented 6 months ago

Description

We are submitting our custom artifact windows-download-artifacts-drop to the public repo for the following reasons:

We are submitting this PR as part of a security effort to eliminate all access tokens and improve reliability across our systems.

The windows-download-artifacts-drop artifact can be used to download an Azure Artifacts Drop to a directory on the DTL machine. Just provide the required account URL, drop name, destination directory, and authentication details. The artifact can authenticate with the drop service using either an access token (via the AccessToken parameter) or Azure Managed Identity (via the ManagedIdentityClientID parameter).

To aid in investigation scenarios, the artifact optionally supports uploading a transcript of the operation and select files to an Azure Artifacts Drop. Simply provide the logs drop service URL, name, and authentication details (again, access token or managed identity). You can optionally specify files you would like to "snapshot" and add to the logs drop at the time of artifact completion via the LogsDropFilesToInclude and LogsDropFilesToExclude parameters.

Validation

You can test this artifact via the following steps:

  1. Create a new Azure Artifacts Drop, upload one or more files to it, and finalize it.
  2. Add this artifact to a new DTL machine with the following input parameters:
    • AccountURL: the URL of the Azure DevOps organization where you created the drop (i.e. the value you passed into the drop.exe create -s argument)
    • DropName: the name of the drop you created (i.e. the value you passed into the drop.exe create -n argument)
    • DestinationDirectory: C:\temp
    • AccessToken: A PAT you generated from the Azure DevOps organization where you created the drop (requires the Drop (Read) scope)
  3. Log on to the DTL machine and look in the C:\temp directory, and you should see the files you uploaded to the drop

Successful Result

Following is a screenshot of the artifact logs of a successful execution of this artifact:

image