Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload bacpac file to LCS asset library issue #788

Closed
nagsworld opened this issue Dec 7, 2023 · 12 comments
Closed

Upload bacpac file to LCS asset library issue #788

nagsworld opened this issue Dec 7, 2023 · 12 comments

Comments

@nagsworld
Copy link

Hello,

I am trying to upload the .bacpac file from my local drive to LCS asster library, and I am end with an error which does not have much details. Please help if anybody have solutions. Please let me know if any further questions.

Here is the error I am receiving on console:
[17:15:56][Start-LcsUploadV2] Something went wrong while working against the LCS API. | Response status code does not indicate success: 500 (Internal Server Error).
WARNING: [17:15:56][Start-LcsUploadV2] Stopping because of errors

Source code;
$LcsApiUri = "https://lcsapi.lcs.dynamics.com"
[int]$ProjectId = 1666824
$BearerToken = "Bearer $($TokenResponse.access_token)" -- Getting token it right...
$LocalPath = "D:\bacpac\sivatestbackup.bacpac"
#$FileType = "SoftwareDeployablePackage"
$FileType = "ProcessDataPackage"
try
{

#Get-PSFMessage -Level Verbose | Write-Host
Invoke-D365LcsUpload -ProjectId $ProjectId `
 -BearerToken $BearerToken `
 -FilePath $LocalPath `
 -LcsApiUri $LcsApiUri `
 -FileType $FileType `
 -FileName "ReadyForTesting" `
 -FileDescription "testing file upload" `
 -RetryTimeout "02:00:30" 
#Get-PSFMessage -Level Verbose | Write-Host
#(Get-D365EnvironmentSetting).Aos

}
catch {
$formattedDateTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "Error occurred while uploading file to asset library tatus: $_ at: current time = $formattedDateTime"
return "Failed"
}

@FH-Inway
Copy link
Member

FH-Inway commented Dec 7, 2023

Thanks for reporting. "Internal server error" indicates that the issue was with the LCS service itself. Is this the first time the upload is being done? Or did it work before?

According to https://www.yammer.com/dynamicsaxfeedbackprograms/threads/2564964316397568 there seems to have been an LCS outage yesterday. Maybe try again to check if it was an intermittent issue and works now?

@FH-Inway
Copy link
Member

FH-Inway commented Dec 7, 2023

See also discussion #614

I just noticed you try to upload the .bacpac file to file type "ProcessDataPackage". I wouldn't expect that part of the asset library to accept database backups. As mentioned in the discussion, it may very well be that Microsoft does not allow uploads of database backups of any kind to the asset library.

@nagsworld
Copy link
Author

Thanks for reporting. "Internal server error" indicates that the issue was with the LCS service itself. Is this the first time the upload is being done? Or did it work before?

According to https://www.yammer.com/dynamicsaxfeedbackprograms/threads/2564964316397568 there seems to have been an LCS outage yesterday. Maybe try again to check if it was an intermittent issue and works now?

Thanks for your reply. I have tried just now but still I am witnessing the same issue.

@nagsworld
Copy link
Author

See also discussion #614

I just noticed you try to upload the .bacpac file to file type "ProcessDataPackage". I wouldn't expect that part of the asset library to accept database backups. As mentioned in the discussion, it may very well be that Microsoft does not allow uploads of database backups of any kind to the asset library.

HI Thanks for your reply,

it was not allowed with .bak file, but with below url, it was working with bacpac file.

https://community.dynamics.com/forums/thread/details/?threadid=3fd87fcd-3d08-4fdd-b388-4a7d834b0e4f

@nagsworld nagsworld reopened this Dec 7, 2023
@nagsworld
Copy link
Author

Thanks for your reply.

I know it is not allowing to .bak file. But if you refer below url, it is working for bacpac file to upload in asset library.

https://community.dynamics.com/forums/thread/details/?threadid=3fd87fcd-3d08-4fdd-b388-4a7d834b0e4f

@Splaxi
Copy link
Collaborator

Splaxi commented Dec 8, 2023

@nagsworld + @Jnagasuresh

The tools are only a wrapper around the official API that is exposed in the LCS platform. From the initial release of the API and the tools, the list of supported files have changed.

Below image shows what the tools support, based on the API in LCS:
image

I never personally used the "ProcessDataPackage" option - and I don't even know what menu item in maps to in LCS:
image

I did read the link - but nowhere could I see any reference bak / bacpac. I seems that the post is handling SoftwareDeployablePackages / zip files - which is a very common usecase, that I even personally are using everyday.

I would argue, that you should try to download any SoftwareDeployablePackage from the Asset Library - and simply upload it again with a new name. That way you know that all the moving parts are working.

When things are failing in PowerShell - you could try to type the following command:

$error

And look into the details, if any, is stored in the variable.

@Jnagasuresh
Copy link

Hi Splaxi,

Thanks for the reply.
I have tried even with package type "SoftwareDeployablePackage" and I am witnessing the same response.

@Splaxi
Copy link
Collaborator

Splaxi commented Dec 8, 2023

Then I would argue that you need to step even further back in the analysis of your access for the LCS api.

A simple test is as follows:

Get-D365LcsApiToken -Username '[email protected]' -Password 'ThisIsAPassword' -ClientId '1f68ab91-550e-4766-858f-cc0627bf995c' -LcsApiUri 'https://lcsapi.lcs.dynamics.com' | Set-D365LcsApiConfig -LcsApiUri 'https://lcsapi.lcs.dynamics.com' -ClientId '1f68ab91-550e-4766-858f-cc0627bf995c' -ProjectId '123456789' -Temporary 
Get-D365LcsEnvironmentMetadata

This is the most basic way to ensure that you have all the needed details in place:
Username + Password
Registered Application (ClientId)
Correct LCS GEO (There are 6+ different endpoint across the world)

If the above fails - the $error will output details that should get you on the right track on what is missing.

To be perfectly clear, you will have to replace ALL values for Username, Password, ClientId and ProjectId - you MIGHT need to utilize another LcsApiUri value than the one mentioned in the above examples.

@nagsworld
Copy link
Author

Then I would argue that you need to step even further back in the analysis of your access for the LCS api.

A simple test is as follows:

Get-D365LcsApiToken -Username '[email protected]' -Password 'ThisIsAPassword' -ClientId '1f68ab91-550e-4766-858f-cc0627bf995c' -LcsApiUri 'https://lcsapi.lcs.dynamics.com' | Set-D365LcsApiConfig -LcsApiUri 'https://lcsapi.lcs.dynamics.com' -ClientId '1f68ab91-550e-4766-858f-cc0627bf995c' -ProjectId '123456789' -Temporary 
Get-D365LcsEnvironmentMetadata

This is the most basic way to ensure that you have all the needed details in place: Username + Password Registered Application (ClientId) Correct LCS GEO (There are 6+ different endpoint across the world)

If the above fails - the $error will output details that should get you on the right track on what is missing.

To be perfectly clear, you will have to replace ALL values for Username, Password, ClientId and ProjectId - you MIGHT need to utilize another LcsApiUri value than the one mentioned in the above examples.


Thank you so much for your time.

I tried the command you have added in above comment and I am able to execute the command Get-D365LcsApiToken with out any errors.

@Splaxi
Copy link
Collaborator

Splaxi commented Dec 12, 2023

What about the Get-D365LcsEnvironmentMetadata ?

@nagsworld
Copy link
Author

it was returning the existing environments to the console.

@Splaxi
Copy link
Collaborator

Splaxi commented Dec 12, 2023

Closing this - as the LCS API doesn't support bacpac / bak files upload....

@Splaxi Splaxi closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants