Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd cmdlet prefix #32
Comments
This comment has been minimized.
This comment has been minimized.
Completely agree. Adding a prefix to the module will...
Perhaps a short acronym like "MSG" and "MSGBeta", short for Microsoft Graph and Microsoft Graph Beta, would be unique-enough to avoid conflicts and still be easy to type. |
This comment has been minimized.
This comment has been minimized.
We have received this feedback from a few people, however for the moment, we are continuing to recommend that people use the -prefix option of We understand there are pros and cons to this approach. However, PowerShell has introduced a feature to specifically avoid namespace clashes and rather than do a land grab on a prefix and hope no-one else ever uses it, we are going to push towards using the built in capability. |
This comment has been minimized.
This comment has been minimized.
The likelihood of someone else using Msg or something for their prefix is much much lower than someone having a The fact this clashes with existing modules produced by MSFT should be enough to require a prefix, future authors will deal with the coming up with their own prefix but those other commands were there first (and should probably have their own prefixes as well) and therefore it's up to you to prefix your commands to prevent clashes for existing users, especially users who might want to trial these and run them side by side. The |
This comment has been minimized.
This comment has been minimized.
Completely agree with this. There's so many potential conflicts that could easily be avoided.
Manifests support a prefix, so that too is a built in capability I would assume? It seems arbitrary not to do it, when most other MSFT modules have done it recently. Sure, most of the clashes here are because some modules do not have prefixes, but we can't really fix the mistakes of the past, only make sure we don't mess up the future. Using
And probably more, if everyone has the same naming convention for these cmdlets, it's a mess to help people and to use scripts shared by others if they don't fit the same naming convention. Imagine a team using several shared scripts that utilize this module, and having written a few of their own. They'll have an internal naming standard for the prefix on this module, but anything they import they'll have to either just live with the fact that it doesn't use the same naming convention, or change it throughout the script so it does fit internal standards. |
This comment has been minimized.
This comment has been minimized.
I would suggest that the team behind this effort make contact with the Power Platform team who developed that technology's Powershell module. The first release had commandlets such as Get-App and the team received (a tad harsh IMHO) feedback to "please change the commandlets to be unique". The team quickly pivoted to use a more specific nomenclature and none of us batted an eyelid, we were all very happy to move on with the new commandlet names even though they were far more verbose. As for using Import-Module -Prefix I cannot remember the last time I added Import-Module to any of my scripts, modern Powershell really doesn't need it does it. I really think about the -Prefix feature to be used to help with any "internal name clashes" I might have with my own and/or 3rd party modules, not a feature that I'd have to use with a Microsoft module. Finally as mentioned above, we'll (hopefully) see this module get widely adopted and used, this will no doubt give rise to blog posts, stackoverflow answers with sample scripts - but we'll quickly end up with adding disclaimers to every post with "for the following scripts to work please use Import-Module -Prefix XYZ". |
This comment has been minimized.
This comment has been minimized.
@darrelmiller lets chat at Ignite (I know you mentioned you wanted to anyway) but please lets use a Prefix that's defined at the module manifest level to keep everyone happy particularly as just like @chrisgardnersage mentioned we have had many different historical issues because of a lack of prefix being added to cmdlets/functions being exported from a module. The fact you also stated But again please please take on the feedback of those above However this comment confuses me
The only feature I can think of (knowing PowerShell as well as I do) that you could mean is to fully module qualify a command like this Like I said, happy to further discuss this in person this week at Ignite |
This comment has been minimized.
This comment has been minimized.
I would also like to see a Prefix used in these cmdlets. I'm experiencing a conflict with the Sharegate cmdlets, who also refuses to use a Prefix. The only way I could get the the Graph Get-Group cmdlet to work was to completely uninstall the Sharegate product. That barrier is way too high for admins. I talked to @darrelmiller a bit about this at Ignite and after trying the -Prefix method I couldn't get that to work either. I'm not sure why the team is reluctant to add a prefix. Maybe if they explain that we could find a solution. |
This comment has been minimized.
This comment has been minimized.
The other thing I'd like to add is that the current instruction for this module use the Install-Module cmdlet to install it, which does not support a Prefix parameter like Import-Module does. I'm not sure how to resolve the two sets of instructions, "Use Install-Module to get these cmdlets, but use Import-Module -Prefix to fix the collision." |
This comment has been minimized.
This comment has been minimized.
Hey folks. I really appreciate your input on this. There is a reason I didn't close this issue and just labeled it as a NotPlanned. :-) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Just to add to the feedback here, the scenarios broken by the lack of a prefix are:
PowerShell being a shell, the default interactive experience is to show all commands globally and load them on demand, like cmd or bash does with utilities rather than the way e.g. Python requires explicit module imports. As a result, manually calling Without the prefix, just installing this module without loading it is something that will break normal workflows, since it will collide with other modules. That means the only safe way to install it is to |
This comment has been minimized.
This comment has been minimized.
I'm confused by how this could be "an awful authoring and usability experience"? As a data professional, I use Candidly, if you're writing a article to show new users how to pipe input from a cmdlet in one module, into a cmdlet from another module: using the full |
This comment has been minimized.
This comment has been minimized.
PLEASE use Gr or GRX or MSG as previously suggested. The conflicts I have are ongoing and NOT easily resolvable, as Todd pointed out. |
This comment has been minimized.
This comment has been minimized.
PowerShell has many defensive scripting techniques with Fully Module Qualifying commands being one of them, Import-Module with prefix another, but the mass majority of PowerShell writers are using the Command Name only in their writing of scripts, mostly because it's so much additional overhead adding the module name to commands that many will not do this unless they absolutely have to. |
This comment has been minimized.
This comment has been minimized.
We will be adding Mg prefixes to all the cmdlets in our 0.1.1 release which we expect to publish to PowerShell Gallery. Stay tuned and THANK YOU for your enthusiastic feedback. |
As discussed briefly the other day on the call, you should consider adding an unique prefix to all the cmdlets. This will not only make them easier to identify with the module, but avoid clashes with existing cmdlets. Prime examples being Get-User and Get-Group - both of these are heavily used in Exchange/Exchange Online PowerShell. And since support for Exchange management tasks in the Graph is still non-existent, it's very likely that people will use both the ExO cmdlets and the Graph module in the same PS session.
Considering the sheer number of cmdlets in the module, you're bound to have other duplicates as well.