Azure Web Sites – BitBucket Continuous Deployment Failure

 

Users can setup 'Integrate Source Control' for an Azure Web Site from a variety of sources like Visual Studio Online, Local Git Repository, GitHib, BitBucket etc. The complete list can be checked by looking into the options under 'Set up deployment from source control' option.

 

One of the user was trying to setup the deployment with BitBucket and it failed with error "Failed to set up continuous deployment for website xxxx, using Bitbucket. Repository 'UpdateSiteSourceControl' operation failed with Microsoft.Web.Hosting.SourceControls.OAuthException: Bitbucket GetWebHookInfo: (403) Forbidden."

 

The complete stack trace may look something like below:

Failed to link source control 'Bitbucket' with site xxxx. Microsoft.Web.Hosting.SourceControls.OAuthException: Bitbucket GetWebHookInfo: (403) Forbidden.

at Microsoft.Web.Hosting.SourceControls.OAuthV1Provider.<ProcessResponse>d__7c`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at Microsoft.Web.Hosting.SourceControls.OAuthV1Provider.<GetAsync>d__58`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.Web.Hosting.SourceControls.BitbucketProxy.<GetWebHookInfo>d__40.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at Microsoft.Web.Hosting.SourceControls.BitbucketProxy.<AddWebHook>d__1b.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.Web.Hosting.Administration.BitbucketSiteRepositoryProvider.<UpdateSiteSourceControl>d__6.MoveNext()

 

 

In general, 403 – Forbidden errors refers to permissions issue.

 

In this case, the user's BitBucket ID was not having admin access to the account. Hence the setup was failing unable to authorize the user to setup the hook in BitBucket.

 

The issue was fixed by providing admin access to the ID of the user.