halliba / az-pipelines-2-sharepoint

Azure DevOps extension - upload build files to SharePoint Online
GNU General Public License v3.0
9 stars 4 forks source link
azure-devops azure-devops-pipelines sharepoint-online

az-pipelines-2-sharepoint

Logo

Version

az-pipelines-2-sharepoint is an Azure DevOps extensions to upload file or build artefacts to a SharePoint Online library via Microsoft Graph.

This extension can not be used with on-premise SharePoint installations.

Installation

Azure Pipelines: Visit the Marketplace page and click install. Choose your Azure DevOps organization.

Azure DevOps Server: Visit the Marketplace page and click install. Then choose Download and install it via the Extension page on your local Azure DevOps Server.

App registration in Azure AD

Register a new application in your Azure AD tenant: (For more info, refer to the Microsoft Docs)

Setup Azure DevOps

  1. Find your target drive ID:
  2. Add a new Upload files to SharePoint Online task to your build pipeline.
  3. Fill in all required parameters.

Parameters

General

Authentication

These parameters can be found at the application registration page in Azure AD. Microsoft Docs

Advanced

Sample YAML config files

Basic example: copy files from the agent working directory / repository

Parameter source is left blank to use the current working directory. This copies all files from the dist folder in the current working dir.

steps:
- task: halliba.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint@0
  displayName: 'Upload files to SharePoint'
  inputs:
    tenantId: 'CCCCCCCC-2222-4444-6666-333333333333'
    clientId: 'AAAAAAAA-1111-3333-5555-FFFFFFFFFFFF'
    clientSecret: '1234567890abcdefghijABCDEFGHIJ1234567890'
    driveId: 'https://contoso.sharepoint.com/sites/some-project/Shared%20Documents'
    targetFolder: '/build-files/$(Build.BuildId)/'
    contents: 'dist/**'

Copy files from the artifact staging directory

steps:
- task: halliba.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint@0
  displayName: 'Upload files to SharePoint'
  inputs:
    ...
    sourceFolder: '$(Build.ArtifactStagingDirectory)'
    contents: '/bin/**/*.dll'

Copy files from ouside the working directory / repository

steps:
- task: halliba.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint.az-pipelines-2-sharepoint@0
  displayName: 'Upload files to SharePoint'
  inputs:
    ...
    sourceFolder: '/var/some-folder/' #or 'D:\some-folder' for Windows
    contents: '**/*.log'

Known Issues