def azure_create_branch(self, from_ref, branch_name): authorization = str(base64.b64encode(bytes(':' + self.azure_api_token, 'ascii')), 'ascii') url = f"{self.azure_base_url}/_apis/git/repositories/{self.azure_repo_id}/refs?api-version=6.0" headers = { 'Authorization': 'Basic ' + authorization } body = [ { 'name': f"refs/heads/{branch_name}", 'oldObjectId': '0000000000000000000000000000000000000000', 'newObjectId': from_ref } ] if globals.debug > 0: print("DEBUG: perform API Call to ADO: " + url + " : " + json.dumps(body, indent=4, sort_keys=True) + "\n") r = requests.post(url, json=body, headers=headers) if r.status_code == 200: if globals.debug > 0: print(f"DEBUG: Success creating branch") print(r.text) return True else: print(f"BD-Scan-Action: ERROR: Failure creating branch: Error {r.status_code}") print(r.text) return False