PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
486 stars 92 forks source link

`Find-PSResource` should tell what platforms a resource supports #1570

Open o-l-a-v opened 7 months ago

o-l-a-v commented 7 months ago

Summary of the new feature / enhancement

Find-PSResource should tell what platforms a resource supports.

There does not seem to be a standardized way to tell if an object obtained with Find-PSResource can be installed and used on Unix.

The PSEdition visible in PowerShell Gallery seems to be present in the tags:

If PSEdition_Core is present it does not neccessarily mean it supports Unix, right?

Current info from Find-PSResource

Here's the output of:

Find-PSResource -Type 'Module' -Name 'Az.Accounts' -Repository 'PSGallery' | ConvertTo-Json -Depth 10 | clip
Click to view ```json { "AdditionalMetadata": { "NormalizedVersion": "2.15.1" }, "Author": "Microsoft Corporation", "CompanyName": "Microsoft Corporation", "Copyright": "Microsoft Corporation. All rights reserved.", "Dependencies": [], "Description": "Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.\r\n\r\nFor more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps", "IconUri": null, "Includes": { "Cmdlet": [ "Disable-AzDataCollection", "Disable-AzContextAutosave", "Enable-AzDataCollection", "Enable-AzContextAutosave", "Remove-AzEnvironment", "Get-AzEnvironment", "Set-AzEnvironment", "Add-AzEnvironment", "Get-AzSubscription", "Connect-AzAccount", "Get-AzContext", "Set-AzContext", "Import-AzContext", "Save-AzContext", "Get-AzTenant", "Send-Feedback", "Resolve-AzError", "Select-AzContext", "Rename-AzContext", "Remove-AzContext", "Clear-AzContext", "Disconnect-AzAccount", "Get-AzContextAutosaveSetting", "Set-AzDefault", "Get-AzDefault", "Clear-AzDefault", "Register-AzModule", "Enable-AzureRmAlias", "Disable-AzureRmAlias", "Uninstall-AzureRm", "Invoke-AzRestMethod", "Get-AzAccessToken", "Open-AzSurveyLink", "Get-AzConfig", "Update-AzConfig", "Clear-AzConfig", "Export-AzConfig", "Import-AzConfig" ], "Command": [ "Disable-AzDataCollection", "Disable-AzContextAutosave", "Enable-AzDataCollection", "Enable-AzContextAutosave", "Remove-AzEnvironment", "Get-AzEnvironment", "Set-AzEnvironment", "Add-AzEnvironment", "Get-AzSubscription", "Connect-AzAccount", "Get-AzContext", "Set-AzContext", "Import-AzContext", "Save-AzContext", "Get-AzTenant", "Send-Feedback", "Resolve-AzError", "Select-AzContext", "Rename-AzContext", "Remove-AzContext", "Clear-AzContext", "Disconnect-AzAccount", "Get-AzContextAutosaveSetting", "Set-AzDefault", "Get-AzDefault", "Clear-AzDefault", "Register-AzModule", "Enable-AzureRmAlias", "Disable-AzureRmAlias", "Uninstall-AzureRm", "Invoke-AzRestMethod", "Get-AzAccessToken", "Open-AzSurveyLink", "Get-AzConfig", "Update-AzConfig", "Clear-AzConfig", "Export-AzConfig", "Import-AzConfig" ], "DscResource": [], "Function": null, "RoleCapability": null, "Workflow": null }, "InstalledDate": null, "InstalledLocation": "", "IsPrerelease": false, "LicenseUri": "https://aka.ms/azps-license", "Name": "Az.Accounts", "Prerelease": "", "ProjectUri": "https://github.com/Azure/azure-powershell", "PublishedDate": "2024-02-06T01:38:46.463", "ReleaseNotes": "* Upgraded the reference of Azure PowerShell Common to 1.3.90-preview.\r\n* Upgraded Azure.Identity to 1.10.3 [#23018].\r\n - Renamed token cache from 'msal.cache' to 'msal.cache.cae' or 'masl.cache.nocae'.\r\n* Enabled Continue Access Evaluation (CAE) for all Service Principals login methods.\r\n* Supported signing in with Microsoft Account (MSA) via Web Account Manager (WAM). Enable it by 'Set-AzConfig -EnableLoginByWam True'.\r\n* Adjusted output format to be more user-friendly for 'Get-AzContext/Tenant/Subscription' and 'Invoke-AzRestMethod'.\r\n* Fixed the multiple 'x-ms-unique-id' values issue.", "Repository": "PSGallery", "RepositorySourceLocation": "https://www.powershellgallery.com/api/v2", "Tags": [ "Azure", "ResourceManager", "ARM", "Accounts", "Authentication", "Environment", "Subscription", "PSModule", "PSEdition_Core", "PSEdition_Desktop", "PSCmdlet_Disable-AzDataCollection", "PSCommand_Disable-AzDataCollection", "PSCmdlet_Disable-AzContextAutosave", "PSCommand_Disable-AzContextAutosave", "PSCmdlet_Enable-AzDataCollection", "PSCommand_Enable-AzDataCollection", "PSCmdlet_Enable-AzContextAutosave", "PSCommand_Enable-AzContextAutosave", "PSCmdlet_Remove-AzEnvironment", "PSCommand_Remove-AzEnvironment", "PSCmdlet_Get-AzEnvironment", "PSCommand_Get-AzEnvironment", "PSCmdlet_Set-AzEnvironment", "PSCommand_Set-AzEnvironment", "PSCmdlet_Add-AzEnvironment", "PSCommand_Add-AzEnvironment", "PSCmdlet_Get-AzSubscription", "PSCommand_Get-AzSubscription", "PSCmdlet_Connect-AzAccount", "PSCommand_Connect-AzAccount", "PSCmdlet_Get-AzContext", "PSCommand_Get-AzContext", "PSCmdlet_Set-AzContext", "PSCommand_Set-AzContext", "PSCmdlet_Import-AzContext", "PSCommand_Import-AzContext", "PSCmdlet_Save-AzContext", "PSCommand_Save-AzContext", "PSCmdlet_Get-AzTenant", "PSCommand_Get-AzTenant", "PSCmdlet_Send-Feedback", "PSCommand_Send-Feedback", "PSCmdlet_Resolve-AzError", "PSCommand_Resolve-AzError", "PSCmdlet_Select-AzContext", "PSCommand_Select-AzContext", "PSCmdlet_Rename-AzContext", "PSCommand_Rename-AzContext", "PSCmdlet_Remove-AzContext", "PSCommand_Remove-AzContext", "PSCmdlet_Clear-AzContext", "PSCommand_Clear-AzContext", "PSCmdlet_Disconnect-AzAccount", "PSCommand_Disconnect-AzAccount", "PSCmdlet_Get-AzContextAutosaveSetting", "PSCommand_Get-AzContextAutosaveSetting", "PSCmdlet_Set-AzDefault", "PSCommand_Set-AzDefault", "PSCmdlet_Get-AzDefault", "PSCommand_Get-AzDefault", "PSCmdlet_Clear-AzDefault", "PSCommand_Clear-AzDefault", "PSCmdlet_Register-AzModule", "PSCommand_Register-AzModule", "PSCmdlet_Enable-AzureRmAlias", "PSCommand_Enable-AzureRmAlias", "PSCmdlet_Disable-AzureRmAlias", "PSCommand_Disable-AzureRmAlias", "PSCmdlet_Uninstall-AzureRm", "PSCommand_Uninstall-AzureRm", "PSCmdlet_Invoke-AzRestMethod", "PSCommand_Invoke-AzRestMethod", "PSCmdlet_Get-AzAccessToken", "PSCommand_Get-AzAccessToken", "PSCmdlet_Open-AzSurveyLink", "PSCommand_Open-AzSurveyLink", "PSCmdlet_Get-AzConfig", "PSCommand_Get-AzConfig", "PSCmdlet_Update-AzConfig", "PSCommand_Update-AzConfig", "PSCmdlet_Clear-AzConfig", "PSCommand_Clear-AzConfig", "PSCmdlet_Export-AzConfig", "PSCommand_Export-AzConfig", "PSCmdlet_Import-AzConfig", "PSCommand_Import-AzConfig", "PSIncludes_Cmdlet" ], "Type": 1, "UpdatedDate": null, "Version": { "Major": 2, "Minor": 15, "Build": 1, "Revision": -1, "MajorRevision": -1, "MinorRevision": -1 } } ```

Proposed technical implementation details (optional)

No response

JustinGrote commented 7 months ago

It's a fair point that just because a module is written for PSCore doesn't mean it supports all platforms. For instance, a module might be a wrapper to a windows-only or linux-only binary.

The tricky thing is how to make this extensible for future platforms that we don't even know exist yet.