Azure / azure-remote-rendering

SDK and samples for Azure Remote Rendering
MIT License
106 stars 38 forks source link

[Conversion Problem] - endpoints/url not up-to-date #94

Closed magmukendi closed 1 year ago

magmukendi commented 1 year ago

Describe the problem

A clear and concise description of what the problem is.

I waas trying to convert and render the 3d model using the Azure's remote rendering but I could not get over the Unable to get an authentication token - please check your accountId and accountKey - Exiting. error message. After exploring the code I noticed that most of the endpoints & url in the ARRUtils.ps1 and Conversion.ps1 files are not well set or outdated. Provide additional information According to the documentation found on microsoft website for the getting service token and remote rendering the endpoints are supposed to be https://sts.$accountDomain/accounts/$accountId/token and https://remoterendering.$remoteRenderingDomain respectively but I found out that the endpoints in the current version of the ARRUtils.ps1 and Conversion.ps1 files is not up-to-date.

Additional context

It would be great if those files could be updated accordingly to the documentations. I made a PR to fix this issue, you can find it here

MichaelZp0 commented 1 year ago

Hi @LeGrandMag,

thanks for finding and reporting on this. I looked at your Pull Request and you are right. If you follow the documentation that will fix the scripts, but sadly it will then break in other scenarios (e.g. if you specify everything on the command line).

There was a disjoint in how the parameters from command line and json were processed. I fixed that in https://github.com/Azure/azure-remote-rendering/pull/96 .

The problem should now be gone if you redownload the script. If that is the case, then great, if not then I think I would need your arrAccountDomain and remoteRenderingDomain you specified in the arrconfig.json to reproduce the issue. (Of course only if you are fine with this and if it does not contain any personal information).

Again huge thanks for raising this :)

magmukendi commented 1 year ago

You are welcome.

I will pull the repo again with the changes you've made. I will try again and keep you posted.

Thank you

magmukendi commented 1 year ago

@MichaelZp0, I have checked your fix and it still is not working for my case. I have the arrconfig.json set up and I am running the powershell script without arguments. e.g .\Conversion.ps1' or.\RenderingSession.ps1`, but it still is not working.

I am new to powershell so I do not fully understand how to work with strings, but I have noticed a odd behavior. On line 14 $cleanedRegion = $cleanedRegion.TrimStart("https://") The TrimStart behavior is super weird. When the first character of the string is included in the string in TrimStart() it is cut.

For instance if do ("good morning).TrimStart("abcdefg") because "g" is the first character of the string and it is contains in the string that need to be cut, it will be removed as well. So the result will be ood morning

In our case, writing ("southeastasia").TrimStart("https://") result in outheastasia. And this can be the case for other region that start with s or any character included in https://

The consequence is that the line 15 if ($AllPublicRegions.Contains($cleanedRegion)) will always return false in case the $cleanedRegion does not contain "https://" and its first character is included in "https://".

I propose to add a condition to check whether the $cleanedRegion contains "https://" and modify trim it accordingly.

I have made a pull request #98 suggesting a solution for that. Let me know this is a good fix.

Please check and let me know.

MichaelZp0 commented 1 year ago

Ahh.. I only checked everything in WestEurope, so I missed that. Sorry.

I checked your PR and that looks great to me. I will run the script with your changes through the signing service and push it.

MichaelZp0 commented 1 year ago

So should be through now.