microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.2k stars 1.45k forks source link

There is no way to enable the necessary features of the SQL Server #3522

Open MirolimMajidov opened 1 year ago

MirolimMajidov commented 1 year ago

Brief description of your issue

I'm using the WinGet configuration for installing some necessary applications with components by creating a Winget configuration (YAML) file and using that from the Dev Home. I did all of them except the SQL Server features. I'm able to install the SQL server, but I could not enable (Install) the "Full-text search" and "FileStream" features of the SQL Server.

Steps to reproduce

There is my configuration file. The first step is passing but the second is not:

#yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: sqlServerPackage
      directives:
        description: Install Microsoft SQL Server 2022 Developer
        allowPrerelease: true
      settings:
        id: Microsoft.SQLServer.2022.Developer
        source: winget
    - resource: Microsoft.SqlServerDsc/SqlServerFeature
      dependsOn:
        - sqlServerPackage
      directives:
        description: Enable necessary SQL Server features
      settings:
        features: 'SQLENGINE, FULLTEXT'
        filestreamlevel: 1
  configurationVersion: 0.2.0

Expected behavior

Somehow we should be doing that because a lot of times just installing the SQL Server is not enough to use that without enabling necessary features or changing the configuration.

Note: If there is a way to do that by a PowerShell script, please show me an example of how to call the PowerShell script from the winget Yamle configuration, until implementing (fixing) this functionality. I did not find any thing for that.

Actual behavior

It is failing from the second step without any errors.

Environment

I am using the latest version of WinGet and Windows 11
stephengillie commented 1 year ago

Feature request: Support configuration files. (We might already have this request in another Issue.)

MirolimMajidov commented 1 year ago

Feature request: Support configuration files. (We might already have this request in another Issue.)

@stephengillie Our company has close to 100 software engineers. So, we are planning to use the Dev Home to decrease the setting up the dev environments. As I said, we have prepared the configuration files to install and customize all necessary applications except the MS SQL Server. That means there is still manual work to install the SQL Server.

You already said you have plans to implement this feature. How long do you think it might take? If it takes more than a week or a month, could you (someone else) show me a workaround until implementing this functionality?

stephengillie commented 1 year ago

Hi @MirolimMajidov,

Thanks for explaining your situation and goals. I'm not sure even if this is on our roadmap currently. I'll defer to @denelon for the best info about our future feature plans.

denelon commented 1 year ago

@MirolimMajidov, I did a quick search for Microsoft.SqlServerDsc at the PowerShell gallery. I didn't see any results. Where did you locate that PowerShell module?

denelon commented 1 year ago

There is a DSC Script Resource. The primary thing to be cautious of is to make sure your script is idempotent so it can be run multiple times without causing a failure or other unintended side effects.

MirolimMajidov commented 1 year ago

@denelon I'm not familiar with the Microsoft.SqlServerDsc, but it seems we can do that with DSC SqlServer script.

denelon commented 1 year ago

@johlju I'm not familiar with SQL DSC. Do you have any docs or anything we could point a user at?

We could also work on a sample configuration over at Dev Home Sample Configurations.

johlju commented 1 year ago

I have no knowledge of how the configuration file mentioned above is used and where the source for Microsoft.SqlServerDsc/SqlServerFeature is comig from. Please provide more details. But I know it is not possible to enable features post-install, other than running install again with the correct arguments. The manifest Microsoft.SQLServer.2022.Developer.installer.yaml does not seem to have any argument options at all? A manifest needs to handle all of these arguments in a real scenario: https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt

There is DSC resource SqlSetup that can install SQL Server: https://github.com/dsccommunity/SqlServerDsc/wiki/SqlSetup

There are a command (Install-SqlDscServer) in SqlServerDsc that can install SQL Server using PowerShell (see comment-based help for docs, there are no community docs as of yet). The source: https://github.com/dsccommunity/SqlServerDsc/blob/main/source/Public/Install-SqlDscServer.ps1

Not sure if this helps anything.

johlju commented 1 year ago

There is also a new DSC resource in the works that better work with the latests SQL Server (support more options): https://github.com/dsccommunity/SqlServerDsc/pull/1912