Renaming GitHub Repo Broke and Disabled Source Control Completely

Barrow, Adam 0 Reputation points
2024-05-22T15:03:58.46+00:00

Originally we had two Azure Automation Accounts (lets call them #1 and #2) that had Source Control enabled with a single GitHub repository.

Then, we created two more automation accounts (#3 and #4) that were also set up with Source Control enabled with the same GitHub repository.

We decided to create separate GitHub repositories for each automation account so we created three more repositories for #2, #3, and #4. The original GitHub repo was renamed but still is setup for Source Control with automation account #1.

So, automation accounts #1-4 all have source control set up with the original GitHub repo but we would like to switch #2-4 into their own source control with their own respective GitHub repos.

The problem is that the GitHub source control for automation accounts #1-4 do not recognize the original GitHub repo name change. It seems to suggest it does because it reflected the name change in the "Source Control Summary" -> "Repository" but the Sync Jobs failed with an error like the following:

Resource not found
'https://api.github.com/repos/example_org/OLD_REPO_NAME/contents/examplesubdir/example_script.ps1?ref=master'.

which suggests that the repository name change was not reflected in the URL being used. So, we tried to delete these source control configurations and are unable to do so. We are now unable to edit, delete, or create new source controls for all four Azure Automation Accounts that had a source control setup for this GitHub repository. It always gives the same error:

An error occurred while deleting the source control named 'GitHub'.
Error details:
SourceControl autoSync setup failed for 'GitHub'..


An error occurred while creating the source control named 'GitHub Redo'.
Error details:
SourceControl autoSync setup failed for 'GitHub Redo'..

So, all four automation accounts have source control that is currently broken, not fixable, and not able to be redone. I have since revoked the OAuth token for source control to ensure that these broken source controls do not try, fail, and trigger failure alerts.

Has anyone else experienced this? And how can I fix it?

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,255 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. William Deitrick 30 Reputation points
    2024-08-08T15:10:01.6666667+00:00

    A little late to the party here, but I just ran into the SourceControl autoSync setup failed error. I found that I could set up sync with Auto Sync turned off, but couldn't get AutoSync to work. Turning on AutoSync would always throw this error.

    It turns out this was happening because the Github user I was authenticating with didn't have the necessary permissions to create webhooks on the source Repository. Once I gave the user those permissions, AutoSync turned on as expected.

    This may or may not be relevant to your situation, but I wanted to share one solution for this unhelpful error in case it helps someone else.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.