-
Notifications
You must be signed in to change notification settings - Fork 101
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
Get-D365LcsEnvironmentMetadata Unauthorized #564
Comments
Hi. You need to have an account and a registered application in place. You can read this wiki, to get the prerequisite in place and then return to the environment Metadata. https://github.com/d365collaborative/d365fo.tools/wiki/How-To-Download-Latest-Bacpac-From-Lcs |
Hi Ok managed to get it to work by getting a bearerToken and using the folloiwng Get-D365LcsEnvironmentMetadata -ProjectId "{ProjectID}" -LCSApiUri "https://lcsapi.lcs.dynamics.com" -TraverseAllPages -EnableException -BearerToken $Token So now i just need to parse the output into a table |
.... | FT will do that for you. |
When using just |FT the output gets truncated I also get these messages when running the command Get-D365LcsEnvironmentMetadata -ProjectId $ProjectId -LCSApiUri "https://lcsapi.lcs.dynamics.com" -TraverseAllPages -EnableException -BearerToken $Token |FT [09:12:05][] Unable to locate the %ServiceDrive% environment variable. It could indicate that the machine is either not configured with D365FO or that you have domain join I assume this is because I'm running this on a none F&O Server? |
Yes to the first question. For the truncation, that is something you should look for within the powershell community and blog posts. I don't know your requirements and what you are trying to solve, but I'm confident that most things should be possible... |
If you could explain what you're trying to achieve and what format you want the data / output to be in, I might be able to give a few and better pointers / directions. |
Let me know if you need anything else. |
Trying to use Get-D365LcsEnvironmentMetadata -ProjectId "{Project ID Removed}" -LCSApiUri "https://lcsapi.lcs.dynamics.com" -TraverseAllPages -EnableException
It get the following Error
[Get-LcsEnvironmentMetadata] Error status code Unauthorized in request for getting the environment metadata a project in LCS. Unauthorized. | The remote server returned an error: (401) Unauthorized.
WARNING: [16:49:59][Get-LcsEnvironmentMetadata] Stopping because of errors
Exception calling "AddRange" with "1" argument(s): "Value cannot be null.
Parameter name: collection"
At line:15163 char:13
Is this because I'm not setting the -BearerToken
How do I get the authentication to work?
The text was updated successfully, but these errors were encountered: