Azure DevOps: policy for branch creation - azure

We want only some people to be able to create 'release/*' branch in Azure DevOps cloud(?) repo.
Unfortunately, I couldn’t find this option in UI.
I also couldn’t find it here
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops
and here
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-permissions?view=azure-devops
I tried to implement it with REST API but my attempts were unsuccessful.
I also didn’t find any extension which could help me with this.
I'm still looking for a solution.

There is not option in the UI to set the create branch permission for branches.
However, you can achieve this by runing tf git permission commands in Developer Command Prompt for Visual Studio to deny the permission to create branches under releases. See below example:
Below command will block the users in Contributors group creating branches under releases
tf git permission /deny:CreateBranch /group:[MyProject]\Contributors /collection:https://dev.azure.com/MyOrganiza/ /teamproject:MyProject /repository:myRepo /branch:releases
Check Git Permission Command for more information.

Related

Repository Problem in Azure DevOps, error code TFS.WebAPI.Exception: TF401027

I'm running into an error code in the Pull request manager Hub in the Azure DevOps:
There was an error during the extension load: TFS.WebApi.Exception: TF401027: You need the Git 'GenericRead' permission to perform this action. Details: identity '...', scope 'repository'.
which leaves me a bit baffling since the team lead and manager is already sure that I have permission to view pull request, I could even comment and fix pull request that I was added on, but the manager hub is where it refused to show up for me.
the permission management
enter image description here
This error occurs when a user with a stakeholder license tries to create a repository
Solution: Upload the license of the user from “StakeHolder” to “Basic” or get him MSDN Visual Studio Professional or Enterprise subscription
By default stakeholders won’t have access to repos but they can try to create repository from organization settings..

Error creating new repository (PERMISSION_DENIED)

I have a problem creating a new repository in Cloud Source Repository (console or gcloud).
In the gcloud case, when I run the following command using either an user account with roles/owner or a service account with roles/source.admin:
gcloud source repos create new-repo
I get the following error:
ERROR: (gcloud.source.repos.create) ResponseError:
status=[PERMISSION_DENIED], code=[403], message=[User [xxx#xxx] does
not have permission to access projects instance [PROJECT_ID] (or it
may not exist): The caller does not have permission].
The project currently has no repositories associated to it. I was able to create one earlier (through the console) which I then deleted before using. I have been unable to create any subsequent repositories since.
Would love to hear some suggestions if anyone else has faced a similar issue.
As you mentioned to have the proper roles on the account this issue is due to not having a billing account linked to the project.
The API methods used to create a repository require the billing on the project to be enabled so to solve it if this is the issue you can perform the following steps
Go to https://console.cloud.google.com/billing
Select the project where you want the repository to reside
Click on Link a Billing Account
A Popup message will show, over there click on Create Billing Account
Follow the wizard

How to disconnect GitHub from Azure Data Factory V2 to enable "Copy data" Feature?

So the problem is that I created Azure Data Factory with git enabled on the portal. After the resource was validated and created, and after clicking on Author and Monitor, the "Copy Data" feature seems to be disabled as shown in the picture below:
When hovered on the "Copy Data": This feature is disabled in 'Data Factory' mode as your factory has GIT enabled. Please switch to 'GIT' mode to use this.
After clicking on the Manage, the disconnect button seems to be disabled again as shown in the picture below.
How do I enable the button and disconnect my GitHub to enable "Copy data" feature?
Update:
Nandan said to check on Author but it is disabled as well.
On the home page of Azure Data Factory, can you see the option "Git repo settings" at the upper right corner? If yes, you can try to remove the GIT connection via this option.
Below are the tickets for the similar questions, you can reference:
Enable Publishing in 'Data Factory' mode
You are not allowed to make changes or publish from 'Data Factory' mode as your factory has GIT enabled
You can disable the GIT by disconnecting via Manage option as seen below:
But initially you would need to go to Author section to hover to drop down to change from Data factory mode to Git Mode:
The above images are via account which has access on GIT as well as ADF.
I logged in via an Account which has contributor access on ADF but no access on the repo and when I logged into ADF I got the below warning which got blocked in pop up of explorer :
And when I clicked on continue, and when I went to Manage section ; the disconnect option was disabled for me as seen below
So I added my account to Repo and after sometime I was able to manage the GIT in ADF
I'm having the exact same issues as the OP. I have an username#mybusiness.itservices user on Azure and a myname#gmail private GitHub account, and it's impossible to invite the Azure user because they don't have an email (they are just for administering Azure resources).
Integration with GitHub: 1) didn't work at all when configured at the launch time of ADF, 2) worked for one session when created within a new ADF instance, and 3) doesn't work when logging back into ADF.
I get the exact same issues: cannot disconnect from git:
and can't change into Git mode to do any work in ADF:
Naturally, the GitHub account has ADF authorised but there's no collaborator on the repo because I can't invite a user who doesn't have email:
None of the linked resources deal with this issue because there's no way to disconnect Git from ADF unless the "disconnect" button is no longer greyed-out. I would really appreciate any more ideas.
I ran into this issue myself and was able to resolve it. It occurred because the collaboration branch was deleted. In the browser, I was unable to select Git mode because it was confused.
To fix it, I turned to PowerShell. You need Powershell with the Az cmdlets installed.
https://learn.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-5.3.0
You'll need to know:
Subscription name in Azure
Data Factory name
Collaboration branch in github
Root folder in github
Account name for github
Repository name in github
Fire up Powershell with the Azure cmdlets and do like so...
Connect-AzAccount
Set-AzContext "<yoursubscriptionname>"
$dataFactory = Get-AzDataFactoryV2 -Name "<your data factory name>"
Set-AzDataFactoryV2 -InputObject $dataFactory -CollaborationBranch "<branch>" -RootFolder "<github root folder>" -AccountName "<github account>" -RepositoryName "<github repository>" -HostName "https://github.com"
When I ran that series of Powershell commands, it asked me if I wanted to overwrite, I said yes. Then I was able to deal with Git in Data Factory again.

BadRequest: The document creation or update failed because of invalid reference

I'm trying to deploy an ADF pipeline using CICD (Azure DevOps Deployment) using a release pipeline.
Here I'm trying to merge stuff from my Collaboration branch to master (usig GIT).
I'm also using:
Azure Deployment:
Create Or Update Resource Group action on SiteOpsConsolidatedProd (Agent Job) as a part of the Continuous Deployment Process
I'm getting the following error:
[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
[error]Details:
##[error]BadRequest: The document creation or update failed because of invalid reference 'irslinked'.
##[error]Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
##[error]Task failed while creating or updating the template deployment.
irslinked is the name of a self-hosted IR (Linked)
this IR: irslinked is also included in the overwrite template parameters list.
As suggested by Microsoft in their ADF CICD best practices, the self-hosted IR should be hosted on a dedicated ADF instance and should be of type shared and linked to the dev/test/prod instances.
Link to the documentation: https://learn.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment#best-practices-for-cicd
Please respond if it works.
This may be helpful for someone. I had a similar invalid reference error. Actually, my ADF was imported from git. I have reconfigured the git with "import existing resource to repository" option.
Azure documentation https://learn.microsoft.com/en-us/azure/data-factory/ci-cd-github-troubleshoot-guide#recover-from-a-deleted-data-factory
If customer had a Self-hosted Integration Runtime in deleted ADF, they
will have to create a new instance in new ADF, also uninstall and
reinstall the instance on their On-prem machine/VM with the new key
obtained. After setup of IR is completed, customer will have to change
the Linked Service to point to new IR and test the connection or it
will fail with error invalid reference.
I had this error message but it referenced a resource that didn't even exist.
I was able to solve it using steps from here:
https://learn.microsoft.com/en-us/azure/data-factory/source-control#troubleshooting-git-integration
Notably:
Disconnect from existing git repo.
Reconnect back to the same repo, but select "import existing resources" into a "Create new git branch".
Then use git to create more commits on top of that branch, which remove all the extra crud that got generated, until the codebase is back to the desired state.
Note that I had to have sequential commits deleting stuff in dependency order, before it would work. i.e. Pipelines, then dataflows, then datasets, then linked services, then Int.Runtimes.

Azure parameter file cannot be found in VSTS

I am implementing a Logic App in Visual Studio.
I created the Logic App which works properly and I can deploy it using VSTS.
But when I am adding a new ARM file (Test1_QA.parameters.json), I cannot find it in VSTS.
In VSTS I am using Azure Resource Group Deployment task.
Of course when I am deploying directly from within VS by right click on the project, I can select the new file.
I searched the web but couldn't find anything.
Any kind of help would be appreciated.
Make sure the file properties in VS have a "Build Action" set to "Content"
Ok, i suppose you would need to commit the file and push it to VSTS.
generally you can do it by using these commands:
git add -a
git commit -m 'commit message'
git push

Resources