Possibly save 1 hour of your time: This error happens after I deployed a script to create my SQL Server Agent job with SSIS packages as steps.
This error basically means your package is not referencing the proper environment. The configuration on your package needs to be associated with the right environment id.
- Right click on your SQL Server Agent job, and choose Steps. The step in our case represents each SSIS package.
- Click on a specific step and click edit.
- Then click on Configuration.
- At the bottom, check the box Environment and then select the environment from the dropdown you have created for the project (You can verify the environment is created under Integration Services Catalogs >> SSISDB >> Project Name >> Environments). Click OK.
- That should fix most people’s issues when they manually create the job.
- In our case, we automate using script to create the job. So we can right click on the job and Script Jobs As >> Create To >> New Query Editor Window.
- By looking at the script, you can find the @command variable for each step. On the value, you will see ENVREFERENCE and then a number. That number is the id you need to use in your script to tie the job to the environment reference properly.