Hi @Manisha Kottary ,
Welcome to Microsoft Q&A forum and thanks for reaching out.
This error message is thrown when there is a discrepancy between your adf_publish branch and your git repo. If the publish branch is out of sync with the main branch and contains out-of-date resources despite a recent publish, try following below steps:
- Remove your current Git repository
- Reconfigure Git with the same settings, but make sure Import existing Data Factory resources to repository is selected and choose New branch
- Create a pull request to merge the changes to the collaboration branch
Below are some examples of situations that can cause a stale publish branch:
- A user has multiple branches. In one feature branch, they deleted a linked service that isn't AKV associated (non-AKV linked services are published immediately regardless if they are in Git or not) and never merged the feature branch into the collaboration branch.
- A user modified the data factory using the SDK or PowerShell
- A user moved all resources to a new branch and tried to publish for the first time. Linked services should be created manually when importing resources.
- A user uploads a non-AKV linked service or an Integration Runtime JSON manually. They reference that resource from another resource such as a dataset, linked service, or pipeline. A non-AKV linked service created through the UX is published immediately because the credentials need to be encrypted. If you upload a dataset referencing that linked service and try to publish, the UX will allow it because it exists in the git environment. It will be rejected at publish time since it does not exist in the data factory service.
Here is a stackoverflow thread where a similar issue has been discussed: https://stackoverflow.com/questions/62468686/badrequest-the-document-creation-or-update-failed-because-of-invalid-reference
Reference public MS doc: ADF - Troubleshooting Git integration
Note: As a best practice please do mask/hide any PI/sensitive information like subscription ID while posting the query :)
Hope this info helps. Do let us know if you have further query.
----------
Please don’t forget to Accept Answer
and Up-Vote
wherever the information provided helps you, this can be beneficial to other community members.