How to migrate Github Private server to another server in Azure Migration - azure

We have Private Github server in Ubuntu running in Azure subscription and requirement is to migrate Github to another private github server. Decided to migrate Azure from one Subscription to another subscription taking the image.
So,What are the steps/process has to be done pre and post activities for Private Github server migration from Azure to Azure subscription?

You mean : You have a Private Git server not a Private GitHub server in Ubuntu I am right?
These links might to help you?
https://azure.microsoft.com/en-gb/documentation/articles/web-sites-publish-source-control/
https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/
Changing a remote's URL
https://help.github.com/articles/changing-a-remote-s-url/
replace remote repository with local repo, but keep commit history of remote

Related

Find out Organization server address in Azure DevOps Server (Installed locally)

I've installed Azure Devops Server 2019 on my local server. Now I want to setup a agent pool. To do this, the I've to follow instructions in the image below.
As here, I just downloaded the zip file an ran the config.cmd file, in the first step, it requires Server Url which as I searched over the net, people enter the Organization Url there.
The problem is I have no organization in my local Azure Devops! and when I click on the logo, It redirects me to project collection page:
What should I enter as Server Url in configuring Agent pool?
Agree with bryanbcook,
We can check the doc and switch the doc version to Azure DevOps Server 2019 to check the Server Url, it should be https://{your_server}/tfs
You can refer to this doc to configure the self-hosted agent.
Azure DevOps Services, which are hosted in the cloud, and Azure DevOps Sever 20XX use slightly different terminology. The term “Organization” and “Project Collection” refer to the same thing.

How to access a private repository from a pipeline Azure Devops?

I have come across this problem that when I queue a build of my flutter code in Azure Pipeline, one of the packages in the pubspec.yaml tries to access a Private Azure repo for one of it's plugin. This is throwing a build error. So how can I solve this in the pipeline.
Thanks in advance.
You can go to the private azure repo, Click Clone and then Click Generate Git Credentials.
Then you will get a username and password. You can use the username and password to access this private repo. For below example:
git clone https://username:password#dev.azure.com/{org}/{proj}/_git/{repo}
You can also use Personal access token(PAT) with Code read scope to access to private azure repo
git clone https://PAT#dev.azure.com/{org}/{proj}/_git/{repo}
Please check here to get a Person access token.
Hope above helps!
The question is about Authentication in Build Pipelines, not for cloning the project. Cloning the project is fine whatever mechanism you consider it works. But how does the Build machine that is residing in cloud knows to authenticate?
So I solved this issue by following these steps:
1) create a PAT token for my account in Profile> Security tokens> personal access token
2) define the scopes / permission and copy that PAT token into my local machine (notepad)
3) use the private dependencies in pubspec yaml
Eg:
plugin_name:
git:
url: https://PAT#dev.azure.com/{org}/{proj}/_git/{repo}
This workflow is already automated and officially supported. You need to install the official Azure Pipeline in your GitHub account via Marketplace. This will trigger an OAuth authentication workflow to connect your Azure Devops and GitHub account.
After successful authentication you will see a GitHub installation token in your Azure DevOps Service Connections.
After this you will be able to access private repo securely in your pipeline.
You can achieve it by using an SSH key with the following steps,
Generate an ssh key pair
Add a public key to the github repo Upload
Private key to the Azure DevOps secure files
Configure the Azure DevOps pipeline via YAML
Here is a sample

Azure and GitHub Connections are not well synced

While creating a project in Azure DevOps , the repository connection to the GitHub has been pointed.
But if you push any code the GitHub repository, this update is not seen from the Azure DevOps Reps view.
Even the creation of the new branches at GitHub site are not shown in Azure DevOps.
This is because it doesn't do what you think it does. Connection is not supposed to sync content across repositories. Its "just" being used to connect to the repository on the build agent and pull the sources. If you want to sync repos in Github and Azure Repos you'd need to implement a custom solution. Nothing built-in exists in Azure Repos or Github.
https://learn.microsoft.com/en-us/azure/devops/boards/github/connect-to-github?view=azure-devops

Azure deployment source not showing private repository from BitBucket

I have a private repository hosted on BitBucket. On Azure I have created a web app and in the app service I want to set a deployment source to my BitBucket instance.
The authorization was ok, but when I want to select a project, the list shows no results.
What can be the issue here ?
Update: it looks like an authorization issue, because when opening the list of branches using the rest api, i get a forbidden result: https://bitbucket.org/api/1.0/repositories/{org}/{repo}/branches
When the admin of my repo is available I'll ask for admin permission and update this post.
It was a permission issue. To have deployment source attached to a BitBucket instance, you need admin rights on the repository.

Deploying website from private Github repository using ARM Templates

I am trying to create a website through Azure Resource Manager and then deploy from a private Github repository.
I have an ARM Template that works for a public repository. if I then make the repository private, connect to it through the Portal it all works fine.
If I redeploy the ARM Template it will fail with the message
"Cannot find SourceControlToken with name GitHub."
It seems that when the portal connects to a private repo it will create an ssh key that is used to authenticate.
The ssh key appears to come from kudu which can be gotten once the site is deployed.
I have also tried using access tokens, but couldn't get these to work with the repourl
So the simple question is, how do I deploy a private repo via ARM template
In order to use this via ARM template, you need to first do it at least once using the Preview Portal (https://portal.azure.com/). You can do this on any site, and with any repo. It just needs to happen once to set up the GitHub relationship. Doing it via the old portal won't work.
Then, to check that things are set up properly:
Go to https://resources.azure.com/
Go under /providers/Microsoft.Web/sourcecontrols/GitHub
Make sure the token is set
It seems that when the portal connects to a private repo it will
create an ssh key that is used to authenticate.
Thats right.
Solve same problem by changing GitHub repository to External Git.
Create new GitHub account and shared read access to private repo
Generate access token
And use next url in templates, in portal, azure rest api, etc.
https://{github-username}:{access-token}#github.com/{organisation-acount}/{repo}.git
Besides, this will help to avoid GitHub limitation for 20 connections, and you can use your repository in more than 20 Azure WebApps.
This error occurs due to connecting Github to multiple Azure accounts. To resolve it, simply revoke all Azure-related apps from the "Authorized OAuth Apps" section in Github settings (https://github.com/settings/applications), then re-authorize Github in Azure. This should allow you to save the deployment.

Resources