Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Synchronise resource credentials from Buildmaster to Otter



  • Hi Guys,

    We currently have Buildmaster synchronising to an Otter instance, however resource credentials are not included in this synch. Is there any way we could achieve this, as we have a significant number of credentials in BM that we would prefer to not have to manually reenter and maintain on an ongoing basis.

    Thanks,

    Clint

    Product: BuildMaster
    Version: 5.8.1


  • inedo-engineer

    Hey Clint;

    This was intentional in the infrastructure sync; credentials are a bit trickier, because of the encryption key and fact that some credentials aren't supported.

    That said, this is definitely on our roadmap and will (likely) come in the form of a new (free) product that manages multiple instances of our tools:

    • users and permissions
    • licenses
    • resource credentials
    • infrastructure (?)
    • other settings?

    In the mean time, it's possible to do with a database script / simple tool that just updates rows from one database to another (ResourceCredentials table). We can certainly help with that if needed.



  • That would be very helpful thanks Alex.

    Clint


  • inedo-engineer

    Hello Clint,

    This SQL will copy any credentials that BuildMaster has but Otter doesn't to Otter. However, it will not work if BuildMaster and Otter use different encryption keys. You can find the encryption keys for BuildMaster and Otter in app_appSettings.config and in web_appSettings.config. The key will look like this in the file: <add key="Persistence.EncryptionKey" value="[encryption key is here]" />

    INSERT INTO [Otter].[dbo].[Credentials] ([Environment_Id], [Credential_Name], [CredentialType_Name], [LegacyConfiguration_Bytes], [Configuration_Xml], [AllowFunctionAccess_Indicator])
    -- Omit the line above this comment to test this before running it for real
    SELECT OE.[Environment_Id]
          ,BC.[Credential_Name]
          ,BC.[CredentialType_Name]
          ,[LegacyConfiguration_Bytes] = NULL
          ,[Configuration_Xml] = CAST(REPLACE(
                                    REPLACE(
                                        REPLACE(
                                            REPLACE(
                                                REPLACE(
                                                    REPLACE(
                                                        REPLACE(
                                                            REPLACE(
                                                                REPLACE(
                                                                    REPLACE(
                                                                        CAST(BC.[Configuration_Xml] AS VARCHAR(MAX)),
                                                                        '<Inedo.BuildMaster.Extensibility.Credentials.BuildMasterCredentials Assembly="BuildMasterCore">',
                                                                        '<Inedo.Otter.Extensions.Credentials.BuildMasterCredentials Assembly="OtterCore">'
                                                                    ),
                                                                    '<Inedo.BuildMaster.Extensibility.Credentials.OtterCredentials Assembly="BuildMasterCore">',
                                                                    '<Inedo.Otter.Extensions.Credentials.OtterCredentials Assembly="OtterCore">'
                                                                ),
                                                                '<Inedo.BuildMaster.Extensibility.Credentials.ProGetCredentials Assembly="BuildMasterCore">',
                                                                '<Inedo.Otter.Extensions.Credentials.ProGetCredentials Assembly="OtterCore">'
                                                            ),
                                                            '<Inedo.BuildMaster.Extensibility.Credentials.PrivateKeyCredentials Assembly="BuildMasterCore">',
                                                            '<Inedo.Otter.Extensions.Credentials.PrivateKeyCredentials Assembly="OtterCore">'
                                                        ),
                                                        '<Inedo.BuildMaster.Extensibility.Credentials.UsernamePasswordCredentials Assembly="BuildMasterCore">',
                                                        '<Inedo.Otter.Extensions.Credentials.UsernamePasswordCredentials Assembly="OtterCore">'
                                                    ),
                                                    '</Inedo.BuildMaster.Extensibility.Credentials.BuildMasterCredentials>',
                                                    '</Inedo.Otter.Extensions.Credentials.BuildMasterCredentials>'
                                                ),
                                                '</Inedo.BuildMaster.Extensibility.Credentials.OtterCredentials>',
                                                '</Inedo.Otter.Extensions.Credentials.OtterCredentials>'
                                            ),
                                            '</Inedo.BuildMaster.Extensibility.Credentials.ProGetCredentials>',
                                            '</Inedo.Otter.Extensions.Credentials.ProGetCredentials>'
                                        ),
                                        '</Inedo.BuildMaster.Extensibility.Credentials.PrivateKeyCredentials>',
                                        '</Inedo.Otter.Extensions.Credentials.PrivateKeyCredentials>'
                                    ),
                                    '</Inedo.BuildMaster.Extensibility.Credentials.UsernamePasswordCredentials>',
                                    '</Inedo.Otter.Extensions.Credentials.UsernamePasswordCredentials>'
                                ) AS XML)
          ,BC.[AllowFunctionAccess_Indicator]
      FROM [BuildMaster].[dbo].[Credentials] BC
      LEFT OUTER JOIN [Otter].[dbo].[Credentials] OC
                   ON BC.[Credential_Name] = OC.[Credential_Name]
      LEFT OUTER JOIN [BuildMaster].[dbo].[Environments] BE
                   ON BC.[Environment_Id] = BE.[Environment_Id]
      LEFT OUTER JOIN [Otter].[dbo].[Environments] OE
                   ON BE.[Environment_Name] = OE.[Environment_Name]
     WHERE OC.[Credential_Id] IS NULL
    


Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation