Microsoft Azure Security Center Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive DevOps security integration for Azure Security Center, providing security management for Azure DevOps, GitHub, and GitLab repositories. Enables security scanning, policy enforcement, and configuration management across development platforms.
Important: DevOps operations require API version 2024-04-01 or 2023-09-01-preview and are not available in the default LATEST_PROFILE. Use a version-specific client:
from azure.mgmt.security.v2024_04_01 import SecurityCenter as SecurityCenter_v2024_04_01
devops_client = SecurityCenter_v2024_04_01(credential, subscription_id)Manage DevOps security configurations and integration settings across supported platforms.
def list(
**kwargs: Any
) -> Iterator[DevOpsConfiguration]:
"""
List DevOps configurations for the subscription.
Returns:
Iterator[DevOpsConfiguration]: Iterator of DevOpsConfiguration objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
**kwargs: Any
) -> DevOpsConfiguration:
"""
Get details of a specific DevOps configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
Returns:
DevOpsConfiguration: DevOps configuration details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
dev_ops_configuration: DevOpsConfiguration,
**kwargs: Any
) -> DevOpsConfiguration:
"""
Create or update a DevOps configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- dev_ops_configuration (DevOpsConfiguration): Configuration data
Returns:
DevOpsConfiguration: Created or updated configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
dev_ops_configuration: DevOpsConfiguration,
**kwargs: Any
) -> DevOpsConfiguration:
"""
Update a DevOps configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- dev_ops_configuration (DevOpsConfiguration): Updated configuration data
Returns:
DevOpsConfiguration: Updated configuration
"""
def delete(
resource_group_name: str,
security_connector_name: str,
**kwargs: Any
) -> None:
"""
Delete a DevOps configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
Returns:
None
"""Track the results and status of DevOps security operations.
def get(
resource_group_name: str,
security_connector_name: str,
operation_result_id: str,
**kwargs: Any
) -> OperationResult:
"""
Get the result of a DevOps operation.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- operation_result_id (str): ID of the operation result
Returns:
OperationResult: Operation result details
"""Manage Azure DevOps organization security integration and monitoring.
def list(
resource_group_name: str,
security_connector_name: str,
**kwargs: Any
) -> Iterator[AzureDevOpsOrg]:
"""
List Azure DevOps organizations connected to the security connector.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
Returns:
Iterator[AzureDevOpsOrg]: Iterator of Azure DevOps organization objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
org_name: str,
**kwargs: Any
) -> AzureDevOpsOrg:
"""
Get details of a specific Azure DevOps organization.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
Returns:
AzureDevOpsOrg: Azure DevOps organization details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
azure_dev_ops_org: AzureDevOpsOrg,
**kwargs: Any
) -> AzureDevOpsOrg:
"""
Create or update an Azure DevOps organization configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- azure_dev_ops_org (AzureDevOpsOrg): Organization configuration data
Returns:
AzureDevOpsOrg: Created or updated organization configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
azure_dev_ops_org: AzureDevOpsOrg,
**kwargs: Any
) -> AzureDevOpsOrg:
"""
Update an Azure DevOps organization configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- azure_dev_ops_org (AzureDevOpsOrg): Updated organization data
Returns:
AzureDevOpsOrg: Updated organization configuration
"""Manage Azure DevOps project security settings and monitoring.
def list(
resource_group_name: str,
security_connector_name: str,
org_name: str,
**kwargs: Any
) -> Iterator[AzureDevOpsProject]:
"""
List Azure DevOps projects in an organization.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
Returns:
Iterator[AzureDevOpsProject]: Iterator of Azure DevOps project objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
**kwargs: Any
) -> AzureDevOpsProject:
"""
Get details of a specific Azure DevOps project.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
Returns:
AzureDevOpsProject: Azure DevOps project details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
azure_dev_ops_project: AzureDevOpsProject,
**kwargs: Any
) -> AzureDevOpsProject:
"""
Create or update an Azure DevOps project configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
- azure_dev_ops_project (AzureDevOpsProject): Project configuration data
Returns:
AzureDevOpsProject: Created or updated project configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
azure_dev_ops_project: AzureDevOpsProject,
**kwargs: Any
) -> AzureDevOpsProject:
"""
Update an Azure DevOps project configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
- azure_dev_ops_project (AzureDevOpsProject): Updated project data
Returns:
AzureDevOpsProject: Updated project configuration
"""Manage Azure DevOps repository security scanning and policy enforcement.
def list(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
**kwargs: Any
) -> Iterator[AzureDevOpsRepository]:
"""
List Azure DevOps repositories in a project.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
Returns:
Iterator[AzureDevOpsRepository]: Iterator of repository objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
repo_name: str,
**kwargs: Any
) -> AzureDevOpsRepository:
"""
Get details of a specific Azure DevOps repository.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
- repo_name (str): Name of the repository
Returns:
AzureDevOpsRepository: Repository details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
repo_name: str,
azure_dev_ops_repository: AzureDevOpsRepository,
**kwargs: Any
) -> AzureDevOpsRepository:
"""
Create or update an Azure DevOps repository configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
- repo_name (str): Name of the repository
- azure_dev_ops_repository (AzureDevOpsRepository): Repository configuration data
Returns:
AzureDevOpsRepository: Created or updated repository configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
org_name: str,
project_name: str,
repo_name: str,
azure_dev_ops_repository: AzureDevOpsRepository,
**kwargs: Any
) -> AzureDevOpsRepository:
"""
Update an Azure DevOps repository configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- org_name (str): Name of the Azure DevOps organization
- project_name (str): Name of the Azure DevOps project
- repo_name (str): Name of the repository
- azure_dev_ops_repository (AzureDevOpsRepository): Updated repository data
Returns:
AzureDevOpsRepository: Updated repository configuration
"""Manage GitHub organization (owner) security integration and monitoring.
def list(
resource_group_name: str,
security_connector_name: str,
**kwargs: Any
) -> Iterator[GitHubOwner]:
"""
List GitHub owners connected to the security connector.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
Returns:
Iterator[GitHubOwner]: Iterator of GitHub owner objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
**kwargs: Any
) -> GitHubOwner:
"""
Get details of a specific GitHub owner.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
Returns:
GitHubOwner: GitHub owner details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
git_hub_owner: GitHubOwner,
**kwargs: Any
) -> GitHubOwner:
"""
Create or update a GitHub owner configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
- git_hub_owner (GitHubOwner): Owner configuration data
Returns:
GitHubOwner: Created or updated owner configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
git_hub_owner: GitHubOwner,
**kwargs: Any
) -> GitHubOwner:
"""
Update a GitHub owner configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
- git_hub_owner (GitHubOwner): Updated owner data
Returns:
GitHubOwner: Updated owner configuration
"""Manage GitHub repository security scanning and policy enforcement.
def list(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
**kwargs: Any
) -> Iterator[GitHubRepository]:
"""
List GitHub repositories for an owner.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
Returns:
Iterator[GitHubRepository]: Iterator of GitHub repository objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
repo_name: str,
**kwargs: Any
) -> GitHubRepository:
"""
Get details of a specific GitHub repository.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
- repo_name (str): Name of the repository
Returns:
GitHubRepository: Repository details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
repo_name: str,
git_hub_repository: GitHubRepository,
**kwargs: Any
) -> GitHubRepository:
"""
Create or update a GitHub repository configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
- repo_name (str): Name of the repository
- git_hub_repository (GitHubRepository): Repository configuration data
Returns:
GitHubRepository: Created or updated repository configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
owner_name: str,
repo_name: str,
git_hub_repository: GitHubRepository,
**kwargs: Any
) -> GitHubRepository:
"""
Update a GitHub repository configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- owner_name (str): Name of the GitHub owner
- repo_name (str): Name of the repository
- git_hub_repository (GitHubRepository): Updated repository data
Returns:
GitHubRepository: Updated repository configuration
"""Manage GitLab group security integration and monitoring.
def list(
resource_group_name: str,
security_connector_name: str,
**kwargs: Any
) -> Iterator[GitLabGroup]:
"""
List GitLab groups connected to the security connector.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
Returns:
Iterator[GitLabGroup]: Iterator of GitLab group objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
**kwargs: Any
) -> GitLabGroup:
"""
Get details of a specific GitLab group.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
Returns:
GitLabGroup: GitLab group details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
git_lab_group: GitLabGroup,
**kwargs: Any
) -> GitLabGroup:
"""
Create or update a GitLab group configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
- git_lab_group (GitLabGroup): Group configuration data
Returns:
GitLabGroup: Created or updated group configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
git_lab_group: GitLabGroup,
**kwargs: Any
) -> GitLabGroup:
"""
Update a GitLab group configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
- git_lab_group (GitLabGroup): Updated group data
Returns:
GitLabGroup: Updated group configuration
"""Manage GitLab project security settings and repository scanning.
def list(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
**kwargs: Any
) -> Iterator[GitLabProject]:
"""
List GitLab projects in a group.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
Returns:
Iterator[GitLabProject]: Iterator of GitLab project objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
project_name: str,
**kwargs: Any
) -> GitLabProject:
"""
Get details of a specific GitLab project.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
- project_name (str): Name of the GitLab project
Returns:
GitLabProject: GitLab project details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
project_name: str,
git_lab_project: GitLabProject,
**kwargs: Any
) -> GitLabProject:
"""
Create or update a GitLab project configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
- project_name (str): Name of the GitLab project
- git_lab_project (GitLabProject): Project configuration data
Returns:
GitLabProject: Created or updated project configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
project_name: str,
git_lab_project: GitLabProject,
**kwargs: Any
) -> GitLabProject:
"""
Update a GitLab project configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the GitLab group
- project_name (str): Name of the GitLab project
- git_lab_project (GitLabProject): Updated project data
Returns:
GitLabProject: Updated project configuration
"""Manage GitLab subgroup security configurations and nested group structures.
def list(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
**kwargs: Any
) -> Iterator[GitLabSubgroup]:
"""
List GitLab subgroups in a parent group.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the parent GitLab group
Returns:
Iterator[GitLabSubgroup]: Iterator of GitLab subgroup objects
"""
def get(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
subgroup_name: str,
**kwargs: Any
) -> GitLabSubgroup:
"""
Get details of a specific GitLab subgroup.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the parent GitLab group
- subgroup_name (str): Name of the subgroup
Returns:
GitLabSubgroup: GitLab subgroup details
"""
def create_or_update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
subgroup_name: str,
git_lab_subgroup: GitLabSubgroup,
**kwargs: Any
) -> GitLabSubgroup:
"""
Create or update a GitLab subgroup configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the parent GitLab group
- subgroup_name (str): Name of the subgroup
- git_lab_subgroup (GitLabSubgroup): Subgroup configuration data
Returns:
GitLabSubgroup: Created or updated subgroup configuration
"""
def update(
resource_group_name: str,
security_connector_name: str,
group_fq_name: str,
subgroup_name: str,
git_lab_subgroup: GitLabSubgroup,
**kwargs: Any
) -> GitLabSubgroup:
"""
Update a GitLab subgroup configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- security_connector_name (str): Name of the security connector
- group_fq_name (str): Fully qualified name of the parent GitLab group
- subgroup_name (str): Name of the subgroup
- git_lab_subgroup (GitLabSubgroup): Updated subgroup data
Returns:
GitLabSubgroup: Updated subgroup configuration
"""class DevOpsConfiguration:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[DevOpsConfigurationProperties]
class DevOpsConfigurationProperties:
provisioning_state: Optional[str] # Succeeded, Failed, Canceled
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
top_level_inventory_list: Optional[List[str]]
auto_discovery: Optional[str] # Disabled, Enabled
class AzureDevOpsOrg:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[AzureDevOpsOrgProperties]
class AzureDevOpsOrgProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
onboarding_state: Optional[str] # NotOnboarded, Onboarded, NotApplicable
auto_discovery: Optional[str] # Disabled, Enabled
class AzureDevOpsProject:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[AzureDevOpsProjectProperties]
class AzureDevOpsProjectProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
parent_org_name: Optional[str]
project_id: Optional[str]
onboarding_state: Optional[str]
auto_discovery: Optional[str]
class AzureDevOpsRepository:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[AzureDevOpsRepositoryProperties]
class AzureDevOpsRepositoryProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
parent_org_name: Optional[str]
parent_project_name: Optional[str]
repo_id: Optional[str]
repo_url: Optional[str]
onboarding_state: Optional[str]
action_able_remediation: Optional[ActionableRemediation]
class GitHubOwner:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[GitHubOwnerProperties]
class GitHubOwnerProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
owner_url: Optional[str]
git_hub_internal_id: Optional[str]
onboarding_state: Optional[str]
class GitHubRepository:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[GitHubRepositoryProperties]
class GitHubRepositoryProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
parent_owner_name: Optional[str]
repo_id: Optional[str]
repo_url: Optional[str]
onboarding_state: Optional[str]
class GitLabGroup:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[GitLabGroupProperties]
class GitLabGroupProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
fully_qualified_name: Optional[str]
fully_qualified_friendly_name: Optional[str]
url: Optional[str]
onboarding_state: Optional[str]
class GitLabProject:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[GitLabProjectProperties]
class GitLabProjectProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
fully_qualified_name: Optional[str]
fully_qualified_friendly_name: Optional[str]
fully_qualified_parent_group_name: Optional[str]
url: Optional[str]
onboarding_state: Optional[str]
class GitLabSubgroup:
id: Optional[str]
name: Optional[str]
type: Optional[str]
system_data: Optional[SystemData]
properties: Optional[GitLabSubgroupProperties]
class GitLabSubgroupProperties:
provisioning_state: Optional[str]
provisioning_status_message: Optional[str]
provisioning_status_update_time_utc: Optional[datetime]
fully_qualified_name: Optional[str]
fully_qualified_friendly_name: Optional[str]
fully_qualified_parent_group_name: Optional[str]
url: Optional[str]
onboarding_state: Optional[str]
class OperationResult:
id: Optional[str]
name: Optional[str]
status: Optional[str] # InProgress, Succeeded, Failed
start_time_utc: Optional[datetime]
end_time_utc: Optional[datetime]
error: Optional[ErrorDetail]
properties: Optional[Any]
class ActionableRemediation:
state: Optional[str] # None, Enabled, Disabled
category_configurations: Optional[List[CategoryConfiguration]]
branch_configurations: Optional[List[TargetBranchConfiguration]]
class CategoryConfiguration:
minimum_severity_level: Optional[str]
category: Optional[str]
class TargetBranchConfiguration:
names: Optional[List[str]]
annotation_details: Optional[List[AnnotationDetails]]from azure.identity import DefaultAzureCredential
from azure.mgmt.security import SecurityCenter
credential = DefaultAzureCredential()
client = SecurityCenter(credential, "subscription-id")
# Create DevOps configuration
devops_config = {
"properties": {
"auto_discovery": "Enabled",
"top_level_inventory_list": ["organization1", "organization2"]
}
}
config = client.dev_ops_configurations.create_or_update(
"security-rg",
"devops-connector",
devops_config
)
print(f"Created DevOps configuration: {config.name}")
# List all configurations
configs = client.dev_ops_configurations.list()
for config in configs:
print(f"Config: {config.name}")
print(f"Auto Discovery: {config.properties.auto_discovery}")
print(f"State: {config.properties.provisioning_state}")# Configure Azure DevOps organization
ado_org_config = {
"properties": {
"auto_discovery": "Enabled",
"onboarding_state": "Onboarded"
}
}
org = client.azure_dev_ops_orgs.create_or_update(
"security-rg",
"devops-connector",
"myorganization",
ado_org_config
)
print(f"Configured Azure DevOps org: {org.name}")
# List projects in the organization
projects = client.azure_dev_ops_projects.list(
"security-rg",
"devops-connector",
"myorganization"
)
for project in projects:
print(f"Project: {project.name}")
print(f"Project ID: {project.properties.project_id}")
print(f"Onboarding State: {project.properties.onboarding_state}")
# List repositories in this project
repos = client.azure_dev_ops_repos.list(
"security-rg",
"devops-connector",
"myorganization",
project.name
)
for repo in repos:
print(f" Repository: {repo.name}")
print(f" URL: {repo.properties.repo_url}")
print(f" Remediation State: {repo.properties.action_able_remediation.state}")# Configure GitHub organization
github_owner_config = {
"properties": {
"onboarding_state": "Onboarded"
}
}
owner = client.git_hub_owners.create_or_update(
"security-rg",
"devops-connector",
"myorg",
github_owner_config
)
print(f"Configured GitHub owner: {owner.name}")
# List repositories for the owner
repos = client.git_hub_repos.list(
"security-rg",
"devops-connector",
"myorg"
)
for repo in repos:
print(f"GitHub Repository: {repo.name}")
print(f"Repository URL: {repo.properties.repo_url}")
print(f"Repository ID: {repo.properties.repo_id}")
print(f"Onboarding State: {repo.properties.onboarding_state}")
# Configure specific repository settings
repo_config = {
"properties": {
"onboarding_state": "Onboarded"
}
}
repo = client.git_hub_repos.create_or_update(
"security-rg",
"devops-connector",
"myorg",
"myrepository",
repo_config
)# Configure GitLab group
gitlab_group_config = {
"properties": {
"onboarding_state": "Onboarded"
}
}
group = client.git_lab_groups.create_or_update(
"security-rg",
"devops-connector",
"mygroup",
gitlab_group_config
)
print(f"Configured GitLab group: {group.name}")
# List projects in the group
projects = client.git_lab_projects.list(
"security-rg",
"devops-connector",
"mygroup"
)
for project in projects:
print(f"GitLab Project: {project.name}")
print(f"Fully Qualified Name: {project.properties.fully_qualified_name}")
print(f"URL: {project.properties.url}")
print(f"Parent Group: {project.properties.fully_qualified_parent_group_name}")
# Configure subgroups
subgroups = client.git_lab_subgroups.list(
"security-rg",
"devops-connector",
"mygroup"
)
for subgroup in subgroups:
print(f"Subgroup: {subgroup.name}")
print(f"Fully Qualified Name: {subgroup.properties.fully_qualified_name}")# Check operation results for async operations
try:
result = client.dev_ops_operation_results.get(
"security-rg",
"devops-connector",
"operation-id"
)
print(f"Operation Status: {result.status}")
print(f"Start Time: {result.start_time_utc}")
print(f"End Time: {result.end_time_utc}")
if result.status == "Failed":
print(f"Error: {result.error}")
except Exception as e:
print(f"Operation not found or completed: {e}")
# Monitor onboarding states across all platforms
print("\nOnboarding Summary:")
print("==================")
# Azure DevOps
ado_orgs = client.azure_dev_ops_orgs.list("security-rg", "devops-connector")
for org in ado_orgs:
print(f"Azure DevOps - {org.name}: {org.properties.onboarding_state}")
# GitHub
gh_owners = client.git_hub_owners.list("security-rg", "devops-connector")
for owner in gh_owners:
print(f"GitHub - {owner.name}: {owner.properties.onboarding_state}")
# GitLab
gl_groups = client.git_lab_groups.list("security-rg", "devops-connector")
for group in gl_groups:
print(f"GitLab - {group.name}: {group.properties.onboarding_state}")Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-security