Skip to content

Instantly share code, notes, and snippets.

@FH-Inway
Created November 6, 2022 17:34
Show Gist options
  • Save FH-Inway/016bbae623de24f878235d44f9bbed67 to your computer and use it in GitHub Desktop.
Save FH-Inway/016bbae623de24f878235d44f9bbed67 to your computer and use it in GitHub Desktop.
Get-D365LCSSharedAssetFile example
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\windows\system32> import-module -name "C:\Repositories\GitHub\FH-Inway\d365fo.tools\d365fo.tools"
PS C:\windows\system32> Get-D365LcsApiToken -ClientId e70cac82-6a7c-4f9e-a8b9-e707b961e986 -Username Lcs-Automation@contoso.com -Password fT1DHcLdeTWC9aumugHr -LcsApiUri https://lcsapi.lcs.dynamics.com | Set-D365LcsApiConfig -ProjectId 123456789
PS C:\windows\system32> $latestNugetFile = Get-D365LcsSharedAssetFile -FileType NuGetPackage -Verbose -Latest
VERBOSE: [09:24:00][Get-LcsSharedAssetFile] Invoke LCS request.
VERBOSE: GET https://lcsapi.lcs.dynamics.com/box/fileasset/GetSharedAssets?fileType=27 with 0-byte payload
VERBOSE: received 71295-byte response of content type application/json; charset=utf-8
VERBOSE: [09:24:02][Get-LcsSharedAssetFile] Total time spent inside the function was 00:00:01.4523220
VERBOSE: [09:24:02][Get-LcsFileAsset] Invoke LCS request.
VERBOSE: GET
https://lcsapi.lcs.dynamics.com/box/fileasset/GetFileAsset/1743653?assetId=8b5a63a5-31d4-4558-81df-70858293b529 with
0-byte payload
VERBOSE: received 892-byte response of content type application/json; charset=utf-8
VERBOSE: [09:24:03][Get-LcsFileAsset] Total time spent inside the function was 00:00:01.2656017
VERBOSE: [09:24:03][Get-D365LcsSharedAssetFile] Total time spent inside the function was 00:00:02.7489842
PS C:\windows\system32> $latestNugetFile
Id : 8b5a63a5-31d4-4558-81df-70858293b529
Name : PEAP PU55/10.0.31 - Platform Build Reference
FileName : Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg
FileDescription : "PEAP PU55/10.0.31 - Platform Build Reference. Version: 7.0.6651.35. This is not meant for
production environments."
SizeByte : 0
State : 2
Scope : 3
CommitStatus : 0
FileLocation : https://uswedpl1catalog.blob.core.windows.net/product-ax7productname/feae8d9b-0d1b-4c67-a725-d1d838
892058/AX7ProductName-12-aefd633a-ed9c-4e81-8411-9cd2b30b0251?sv=2018-03-28&sr=b&sig=secret&se=2022-11-09T17%3A24%3A07Z&sp=r
FileType : 27
ModifiedDate : 2022-11-02T20:01:57.207
CreatedDate : 2022-11-02T19:59:18.02
Version : 1
IsMockData : False
ParentFileAssetId : 921f528b-693b-4694-a715-b55d94db2abd
ArtifactId : feae8d9b-0d1b-4c67-a725-d1d838892058
AssetProperties : {}
AssetId : 8b5a63a5-31d4-4558-81df-70858293b529
PS C:\windows\system32> Invoke-D365AzCopyTransfer -SourceUri $latestNugetFile.FileLocation -DestinationUri C:\Temp\$($latestNugetFile.FileName) -ShowOriginalProgress -Verbose
VERBOSE: [09:24:13][Invoke-Process] Starting the AzCopy.exe
VERBOSE: [09:24:13][Invoke-Process] Waiting for the AzCopy.exe to complete
INFO: Scanning...
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
Job f7c723d4-da7b-fa49-7083-8004dcc82ea9 has started
Log file is located at: C:\Users\Administrator\.azcopy\f7c723d4-da7b-fa49-7083-8004dcc82ea9.log
100.0 %, 1 Done, 0 Failed, 0 Pending, 0 Skipped, 1 Total,
Job f7c723d4-da7b-fa49-7083-8004dcc82ea9 summary
Elapsed Time (Minutes): 0.8028
Number of File Transfers: 1
Number of Folder Property Transfers: 0
Total Number of Transfers: 1
Number of Transfers Completed: 1
Number of Transfers Failed: 0
Number of Transfers Skipped: 0
TotalBytesTransferred: 253483840
Final Job Status: Completed
VERBOSE: [09:25:02][Invoke-Process] Standard output was: \r\n
VERBOSE: [09:25:02][Invoke-Process] Total time spent inside the function was 00:00:49.2451920
FileName : Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg
File : C:\Temp\Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg
SourceUri : C:\Temp\Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg
VERBOSE: [09:25:02][Invoke-D365AzCopyTransfer] Total time spent inside the function was 00:00:49.4358502
PS C:\windows\system32>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment