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

SqlIntegrationServicesCatalog: Resource to perform the initial creation of the Integration Services Catalog #2004

Open
SQLCanuck opened this issue Apr 12, 2024 · 5 comments
Labels
help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module.

Comments

@SQLCanuck
Copy link

Resource proposal

Microsoft has documented how to problematically create the SSIS Catalog here https://learn.microsoft.com/en-us/sql/integration-services/catalog/ssis-catalog?view=sql-server-ver16#to-create-the-ssisdb-catalog-programmatically

It would be beneficial if the SqlServerDsc was able to incorporate this additional capability, to automate another part of configuring a SQL Server.

Proposed properties

Property Type qualifier Data type Description Default value Allowed values
CatalogPassword Password String Password utilized to encrypt the Integration Services Catalog None None

Special considerations or limitations

None.

@johlju
Copy link
Member

johlju commented Apr 14, 2024

I can see a public command for this. You mention a resource but it looks like you mean a command? Maybe you aiming for both?

Would be great if we can avoid using Load() or LoadWithPartialName() since it will just return the first version if finds in the GAC, which can be the wrong version if multiple SQL Server major versions are installed.

It would be better if the type was available by just running Import-Module.

Import-Module -Name 'SqlServer' # or 'dbatools' might work?
$smoServer = Connect-SqlDscDatabaseEngine -ServerName 'testclu01a' -InstanceName 'SQL2014'
# If the correct assembly is missing in the module SqlServer (or dbatools) this call fails.
$integrationServices = New-Object -TypeName 'Microsoft.SqlServer.Management.IntegrationServices.IntegrationServices' -ArgumentList @($smoServer)

@johlju
Copy link
Member

johlju commented Apr 14, 2024

If using Import-Module as mentioned in previous comment fails then as an alternative we should aim to use Load() to make sure the correct version of the assembly is loaded. See example:

$connectionInfo = Import-Assembly -Name "Microsoft.SqlServer.ConnectionInfo, Version=$SqlMajorVersion.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"

Import-Assembly is an internal function

@SQLCanuck
Copy link
Author

SQLCanuck commented Apr 15, 2024

Ideally it would be a resource. So could do something like the following in DSC to create an Integration Services Catalog.

SqlIntegrationServicesCatalog 'SSISDB' {
ServerName = 'localhost'
InstanceName = 'MSSQLSERVER'
CatalogPassword = $secret
Ensure = 'Present'
}

@SQLCanuck SQLCanuck changed the title Initialize-SqlDscIntegrationServicesCatalog: Resource to perform the initial creation of the Integration Services Catalog SqlIntegrationServicesCatalog: Resource to perform the initial creation of the Integration Services Catalog Apr 15, 2024
@SQLCanuck
Copy link
Author

SQLCanuck commented Apr 15, 2024

For now I am utilizing the Microsoft documented commands in a Script Task. Though oddly fails for SQL 2022, but works for all other versions of SQL which I have tested (2019, 2016).

With SQL 2022 only, it produces this error and only when run in DSC. If executed manually on the server it works.

image

@johlju
Copy link
Member

johlju commented Apr 16, 2024

Would be great if this would be a public commands (Get-, Test-, New-), then the public commands can be used in a class-based resource.

The error you seeing can be the result of conflicting assemblies. That looks like a typical error for those scenarios when using the Load() methods. Important that all resources use the correct version of the same assemblies. But I'm just guessing, it could be another problem.

@johlju johlju added help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module. labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module.
Projects
None yet
Development

No branches or pull requests

2 participants