{"record":{"id":"9c612c1139b8be7a","repo":"testcontainers/testcontainers-java","slug":"the-image-s-requires-a-microsoft-sql-server-container-please","errorCode":null,"errorMessage":"The image %s requires a Microsoft SQL Server container. Please provide one with the withMsSqlServerContainer method!","messagePattern":"The image (.+?) requires a Microsoft SQL Server container\\. Please provide one with the withMsSqlServerContainer method!","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/azure/src/main/java/org/testcontainers/azure/ServiceBusEmulatorContainer.java","lineNumber":84,"sourceCode":"    public ServiceBusEmulatorContainer withConfig(final Transferable config) {\n        withCopyToContainer(config, \"/ServiceBus_Emulator/ConfigFiles/Config.json\");\n        return this;\n    }\n\n    /**\n     * Accepts the EULA of the container.\n     *\n     * @return this\n     */\n    public ServiceBusEmulatorContainer acceptLicense() {\n        withEnv(\"ACCEPT_EULA\", \"Y\");\n        return this;\n    }\n\n    @Override\n    protected void configure() {\n        if (msSqlServerContainer == null) {\n            throw new IllegalStateException(\n                \"The image \" +\n                getDockerImageName() +\n                \" requires a Microsoft SQL Server container. Please provide one with the withMsSqlServerContainer method!\"\n            );\n        }\n        withEnv(\"SQL_SERVER\", msSqlServerContainer.getNetworkAliases().get(0));\n        withEnv(\"MSSQL_SA_PASSWORD\", msSqlServerContainer.getPassword());\n        // If license was not accepted programmatically, check if it was accepted via resource file\n        if (!getEnvMap().containsKey(\"ACCEPT_EULA\")) {\n            LicenseAcceptance.assertLicenseAccepted(this.getDockerImageName());\n            acceptLicense();\n        }\n    }\n\n    /**\n     * Returns the connection string.\n     *\n     * @return connection string","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/azure/src/main/java/org/testcontainers/azure/ServiceBusEmulatorContainer.java#L66-L102","documentation":"The Azure Service Bus emulator image requires a Microsoft SQL Server container as its backing store. ServiceBusEmulatorContainer.configure() checks for it before startup and throws IllegalStateException if withMsSqlServerContainer was never called.","triggerScenarios":"Creating a ServiceBusEmulatorContainer(dockerImageName) and calling start() without first invoking withMsSqlServerContainer(msSqlContainer), or without both containers sharing a Network.","commonSituations":"Following older examples predating the SQL Server prerequisite; defining the MSSQL container in the test class but forgetting to wire it via withMsSqlServerContainer; missing the shared network so the emulator also fails to reach SQL even when configured.","solutions":["Instantiate an MSSQLServerContainer, attach both containers to the same Network, and call withMsSqlServerContainer(mssql) before start()","Ensure the SQL Server container is started (e.g. @Container/@BeforeEach ordering) before the Service Bus emulator","Use an SQL Server image version compatible with the emulator (per module documentation)"],"exampleFix":"// before\nServiceBusEmulatorContainer sb = new ServiceBusEmulatorContainer(dockerImageName);\n// after\nNetwork network = Network.newNetwork();\nMSSQLServerContainer<?> mssql = new MSSQLServerContainer<>(DockerImageName.parse(\"mcr.microsoft.com/mssql/server:2022-latest\")).acceptLicense().withNetwork(network);\nServiceBusEmulatorContainer sb = new ServiceBusEmulatorContainer(dockerImageName)\n    .withNetwork(network)\n    .withMsSqlServerContainer(mssql);","handlingStrategy":"validation","validationCode":"if (serviceBus == null || mssql == null || network == null)\n    throw new IllegalStateException(\"Wire ServiceBusEmulatorContainer with withMsSqlServerContainer() and a shared Network before start()\");","typeGuard":null,"tryCatchPattern":"try {\n    serviceBus.start();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"withMsSqlServerContainer\")) {\n        throw new IllegalStateException(\"Test setup bug: Service Bus emulator needs SQL Server container\", e);\n    }\n    throw e;\n}","preventionTips":["Create a reusable @Container fixture wiring MSSQL + Service Bus emulator on one network","Remember .acceptLicense() on the MSSQL container","Start dependencies in dependency order (MSSQL before Service Bus emulator)"],"tags":["azure","service-bus","sql-server","missing-dependency","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}