Reputation: 5540
I have created a build pipeline for the Unity3D project in Azure DevOps. I have successfully generated artifacts for the Unity3D project. I want to upload the artifacts of the Unity3D project into SharePoint Online using the Azure DevOps release pipeline.
So, can anyone suggest to me if there is any release task to upload files into SharePoint Online using the Azure DevOps release pipeline?
Upvotes: 1
Views: 5666
Reputation: 315
As an alternative, I described a solution using Power Automate to extract artifact from Azure Pipeline and upload to SharePoint: How to extract files from Azure Pipeline artifacts using Power Automate
Upvotes: 0
Reputation: 2297
You can use AzurePowerShell@5 Task to achieve this, More details here on this URL https://dev.to/kkazala/azure-devops-pipeline-with-workload-identity-federation-2gpj
Following is sample code
- task: AzurePowerShell@5
name: Upload Folder To SP
inputs:
azureSubscription: {SerivicePrincipal Name Created in ADO}
azurePowerShellVersion: latestVersion
ScriptType: InlineScript
Inline: |
try {
$azAccessToken = Get-AzAccessToken -ResourceUrl "https://{tenantID}.sharepoint.com"
$siteUrl = "https://{tenantID}.sharepoint.com/sites/{sitename}"
$conn = Connect-PnPOnline -Url $siteUrl -AccessToken $azAccessToken.Token -ReturnConnection
Write-Host $conn.Url
}
catch {
Write-Host "##[error] 1 (Connect-PnPOnline -AccessToken): $($_.Exception.Message)"
}
try {
$lists = Get-PnPList -Connection $conn
Write-Host "List names:"
$lists | ForEach-Object { Write-Host $_.Title }
$sharePointFolderUrl = "$siteUrl/Dokumente"
Add-PnPFolder -Name $folderName -Folder $sharePointFolderUrl -Connection $conn
}
catch {
Write-Host "##[error] 2 (Add-PnPFolder): $($_.Exception.Message)"
}
Note: You have to use following command to provide permission for specific site
Grant-PnPAzureADAppSitePermission -AppId 'xxx' -Site 'https://xx.sharepoint.com/sites/{sitename}' -Permissions Write
Upvotes: 0
Reputation: 105
Yes, you can upload your artifacts on sharepoint directory. Please find the Azure devops extension which will do the work.
https://marketplace.visualstudio.com/items?itemName=halliba.az-pipelines-2-sharepoint
This extension is well documented and all the necessary steps are given.
Thanks
Upvotes: 1