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

Confusing "Getting Your AppId" section in SETUP #63

Closed
martinsuchan opened this issue Oct 2, 2017 · 3 comments
Closed

Confusing "Getting Your AppId" section in SETUP #63

martinsuchan opened this issue Oct 2, 2017 · 3 comments

Comments

@martinsuchan
Copy link

Hi,
this should probably be changed - the Getting Your AppID section in SETUP.md is a bit confusing. It shows AppIn in format 0ABCDEF12345 but then it uses App Name in the command.
I found my AppId in Dev Dashboard and was wondering for few hours why the command is not working. The command should either use "id -like 0ABCDEF12345" or the difference between App name and Id should be described in a better way. Or just point the developer to the App management -> App identity section in Dashboard where the AppId is located.

Related issue that should probably be fixed as well - more meaningful error messages (should I create another ticket?).

If this command

Get-Applications -GetAll | Where-Object primaryName -like "*<appName>*" | Format-Application

does not find any app, only this error message is displayed. I had to dig through the source code to discover that $ApplicationData in Format-Application is null and Write-Log then receives invalid Message parameter. This pointed me to wrong AppId in the command.

Write-Log : Cannot validate argument on parameter 'Message'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Users\marti\Documents\WindowsPowerShell\Modules\StoreBroker\StoreBroker\StoreIngestionApplicationApi.ps1:303 char:18
+        Write-Log $($output -join [Environment]::NewLine)
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Write-Log], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Write-Log
@HowardWolosky
Copy link
Member

HowardWolosky commented Oct 2, 2017

Hi @martinsuchan -- thanks for the feedback.

Regarding your second issue first, the issue in your case was piping the result from the second command (the Where-Object) straight into Format-Application even though it had no results. The error you received was correct for Format-Application, as Message could have been invalid due to a myriad of reasons. If you had only run Get-Applications -GetAll | Where-Object primaryName -like "*<appName>*", you would have seen that you had no results (which is the reason that Format-Applications was failing). This is the nature of how PowerShell works with regards to piping command output from one command to another. That is pretty much what that error is indicating as well (it's a standard PowerShell command validation error, given that it's PowerShell that is providing that error). You could have then stepped back even further and just run Get-Applications -GetAll or Get-Applications -GetAll | Format-Applications.

For your first issue, I will update the documentation to also indicate that users can find the AppId in the dev portal. StoreBroker was originally written for Microsoft prior to open-sourcing, and due to us enforcing security through least privilege, few employees actually have access to the dev portal itself. Therefore, the common way for them to identify their app's AppId would be to search for their app's name in the full application list returned from StoreBroker, and then extract the id from the result.

@martinsuchan
Copy link
Author

Regarding the error, I understand how piping commands work, but it might be more useful to throw "Format-Application -> ApplicationData is null" rather then trying to call Write-Log with null value.

@HowardWolosky
Copy link
Member

Ah, I missed it was Write-Log throwing that parameter validation error. Thanks. In this case, I think I'll update Write-Log to accept null/empty string values for Message. That would be more consistent with how PowerShell tends to deal with empty results sets (not throwing an error, just printing nothing).

I have separately updated the documentation both with your suggestion for alternatively grabbing it from the Dev Portal, as well as some clarification that users can also simply run Get-Applications -GetAll | Format-Applications if they don't have a ton of applications and they are having issues writing their query expression with Where-Object.

HowardWolosky added a commit to hwbackup/StoreBroker that referenced this issue Oct 2, 2017
@martinsuchan reported that SETUP.md was a bit confusing
regarding how to get the `AppId`.  I've updated the section
to indicate how to get it from the DevPortal directly, as well
as how to get it with a simplified piping command (without the
`Where-Object`).

Additionally, this removes the restriction on `Write-Log` that
message must be non-null/empty.  Requiring a non-null/empty
string resulted in error messages that focused on bad input
to `Write-Log`, which should really be a black-box command
to users of StoreBroker.  Instead, we'll let empty strings
be logged, which should cause users to look into the command
that they were executing instead.  This is more in-line with
how PowerShell default commands handle situations where there
is no result.

Resolves microsoft#63 - Confusing "Getting Your AppId" section in SETUP
HowardWolosky added a commit to hwbackup/StoreBroker that referenced this issue Oct 2, 2017
@martinsuchan reported that SETUP.md was a bit confusing
regarding how to get the `AppId`.  I've updated the section
to indicate how to get it from the DevPortal directly, as well
as how to get it with a simplified piping command (without the
`Where-Object`).

Additionally, this removes the restriction on `Write-Log` that
message must be non-null/empty.  Requiring a non-null/empty
string resulted in error messages that focused on bad input
to `Write-Log`, which should really be a black-box command
to users of StoreBroker.  Instead, we'll let empty strings
be logged, which should cause users to look into the command
that they were executing instead.  This is more in-line with
how PowerShell default commands handle situations where there
is no result.

Resolves microsoft#63 - Confusing "Getting Your AppId" section in SETUP
HowardWolosky added a commit to hwbackup/StoreBroker that referenced this issue Oct 6, 2017
@martinsuchan reported that SETUP.md was a bit confusing
regarding how to get the `AppId`.  I've updated the section
to indicate how to get it from the DevPortal directly, as well
as how to get it with a simplified piping command (without the
`Where-Object`).

Additionally, this removes the restriction on `Write-Log` that
message must be non-null/empty.  Requiring a non-null/empty
string resulted in error messages that focused on bad input
to `Write-Log`, which should really be a black-box command
to users of StoreBroker.  Instead, we'll let empty strings
be logged, which should cause users to look into the command
that they were executing instead.  This is more in-line with
how PowerShell default commands handle situations where there
is no result.

Resolves microsoft#63 - Confusing "Getting Your AppId" section in SETUP
HowardWolosky added a commit that referenced this issue Oct 6, 2017
@martinsuchan reported that SETUP.md was a bit confusing
regarding how to get the `AppId`.  I've updated the section
to indicate how to get it from the DevPortal directly, as well
as how to get it with a simplified piping command (without the
`Where-Object`).

Additionally, this removes the restriction on `Write-Log` that
message must be non-null/empty.  Requiring a non-null/empty
string resulted in error messages that focused on bad input
to `Write-Log`, which should really be a black-box command
to users of StoreBroker.  Instead, we'll let empty strings
be logged, which should cause users to look into the command
that they were executing instead.  This is more in-line with
how PowerShell default commands handle situations where there
is no result.

Resolves #63 - Confusing "Getting Your AppId" section in SETUP
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

2 participants