From 15ae86fbb479284df793a4cbc6b7f2b2c5de2898 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 28 May 2026 04:15:53 +0000 Subject: [PATCH] Configurations: 'specification/security/resource-manager/Microsoft.Security/Security/tspconfig.yaml', API Version: 2022-01-01, SDK Release Type: beta, and CommitSHA: 'cb62053a18882dd258d9922be9770702b7ef6ac9' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6362428 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/security/azure-mgmt-security/CHANGELOG.md | 7 + .../azure-mgmt-security/_metadata.json | 4 +- .../apiview-properties.json | 3 +- .../azure/mgmt/security/_client.py | 7 +- .../azure/mgmt/security/_patch.py | 1 - .../azure/mgmt/security/_utils/model_base.py | 400 +++++++++++++++--- .../mgmt/security/_utils/serialization.py | 29 +- .../azure/mgmt/security/_version.py | 2 +- .../azure/mgmt/security/aio/_client.py | 7 +- .../azure/mgmt/security/aio/_patch.py | 1 - .../security/aio/operations/_operations.py | 176 ++++---- .../mgmt/security/aio/operations/_patch.py | 1 - .../azure/mgmt/security/models/_models.py | 14 +- .../azure/mgmt/security/models/_patch.py | 1 - .../mgmt/security/operations/_operations.py | 176 ++++---- .../azure/mgmt/security/operations/_patch.py | 1 - ...by_azure_api_management_service_example.py | 43 ++ ...by_azure_api_management_service_example.py | 43 ++ ...lections_list_by_resource_group_example.py | 42 ++ ...ollections_list_by_subscription_example.py | 40 ++ ...fboard_azure_api_management_api_example.py | 42 ++ ...nboard_azure_api_management_api_example.py | 43 ++ .../arc_machine_baseline_rules_add.py | 42 ++ .../arc_machine_baseline_rules_delete.py | 42 ++ .../arc_machine_baseline_rules_get.py | 43 ++ .../arc_machine_baseline_rules_list.py | 43 ++ .../arc_machine_baseline_rules_put.py | 43 ++ .../arc_machine_scan_results_get.py | 44 ++ .../arc_machine_scan_results_list.py | 44 ++ .../arc_machine_scans_get.py | 43 ++ .../arc_machine_scans_list.py | 43 ++ .../cancel_malware_scan_example.py | 44 ++ ...sessments_metadata_subscription_example.py | 53 +++ ...visioning_settings_subscription_example.py | 43 ++ .../create_git_hub_issues_example.py | 43 ++ .../create_io_tsecurity_solution.py | 66 +++ ...reate_jit_network_access_policy_example.py | 93 ++++ ...te_or_update_azure_dev_ops_orgs_example.py | 46 ++ ...r_update_azure_dev_ops_projects_example.py | 47 ++ ...e_or_update_azure_dev_ops_repos_example.py | 48 +++ ...ions_onboard_current_and_future_example.py | 46 ++ ...igurations_onboard_current_only_example.py | 46 ++ ...configurations_onboard_selected_example.py | 50 +++ ...s_with_agentless_configurations_example.py | 56 +++ ...e_information_protection_policy_example.py | 74 ++++ .../create_security_contact_example.py | 53 +++ ...erver_vulnerability_assessments_example.py | 44 ++ .../create_workspace_setting_example.py | 48 +++ .../delete_alerts_suppression_rule_example.py | 40 ++ .../delete_application_example.py | 40 ++ .../delete_assessment_example.py | 42 ++ ...sessments_metadata_subscription_example.py | 40 ++ .../delete_assignment_example.py | 41 ++ .../delete_automation_example.py | 41 ++ ...ent_group_custom_recommendation_example.py | 41 ++ ...agement_group_security_standard_example.py | 41 ++ ...connector_custom_recommendation_example.py | 42 ++ ...ity_connector_security_standard_example.py | 42 ++ ...scription_custom_recommendation_example.py | 41 ++ ..._subscription_security_standard_example.py | 41 ++ .../delete_dev_ops_configurations_example.py | 41 ++ .../delete_device_security_groups_example.py | 42 ++ .../delete_governance_assignment_example.py | 43 ++ .../delete_governance_rule_example.py | 41 ++ .../delete_io_tsecurity_solution.py | 41 ++ ...elete_jit_network_access_policy_example.py | 42 ++ ...anagement_group_governance_rule_example.py | 41 ++ ...urce_pricing_by_name_containers_example.py | 42 ++ .../delete_resource_pricing_example.py | 42 ++ ..._security_connector_application_example.py | 42 ++ .../delete_security_connector_example.py | 41 ++ ...urity_connector_governance_rule_example.py | 42 ++ .../delete_security_contact_example.py | 40 ++ ...elete_security_operator_by_name_example.py | 41 ++ ...erver_vulnerability_assessments_example.py | 43 ++ ...lnerability_assessments_setting_example.py | 41 ++ .../delete_standard_assignment.py | 42 ++ .../delete_standard_example.py | 41 ++ .../delete_workspace_setting_example.py | 40 ++ ...nced_threat_protection_settings_example.py | 42 ++ ...t_alert_resource_group_location_example.py | 43 ++ ...get_alert_subscription_location_example.py | 42 ++ .../get_alerts_resource_group_example.py | 42 ++ ..._alerts_resource_group_location_example.py | 43 ++ .../get_alerts_subscription_example.py | 40 ++ ...t_alerts_subscriptions_location_example.py | 42 ++ .../get_alerts_suppression_rule_example.py | 41 ++ .../get_alerts_suppression_rules_example.py | 40 ++ ...ppression_rules_with_alert_type_example.py | 40 ++ .../get_allowed_connections_example.py | 43 ++ ...llowed_connections_subscription_example.py | 40 ++ ...nnections_subscription_location_example.py | 42 ++ .../get_application_example.py | 41 ++ .../get_assessment_example.py | 43 ++ .../get_assessment_with_expand_example.py | 43 ++ .../get_assessments_metadata_example.py | 41 ++ ...sessments_metadata_subscription_example.py | 41 ++ .../get_assignment_example.py | 42 ++ ...ovisioning_setting_subscription_example.py | 41 ++ ...visioning_settings_subscription_example.py | 40 ++ .../get_automation_resource_group_example.py | 42 ++ .../get_automations_resource_group_example.py | 42 ++ .../get_automations_subscription_example.py | 40 ++ .../get_azure_dev_ops_orgs_example.py | 43 ++ .../get_azure_dev_ops_projects_example.py | 44 ++ .../get_azure_dev_ops_repos_example.py | 45 ++ ...ent_group_custom_recommendation_example.py | 42 ++ ...agement_group_security_standard_example.py | 42 ++ ...connector_custom_recommendation_example.py | 43 ++ ...ity_connector_security_standard_example.py | 43 ++ ...scription_custom_recommendation_example.py | 42 ++ ..._subscription_security_standard_example.py | 42 ++ .../get_compliance_example.py | 42 ++ .../get_compliance_results_example.py | 42 ++ .../get_compliances_example.py | 42 ++ ...m_information_protection_policy_example.py | 42 ++ ...t_defender_for_storage_settings_example.py | 43 ++ .../get_dev_ops_configurations_example.py | 42 ++ ...s_with_agentless_configurations_example.py | 43 ++ ...onfigurations_with_capabilities_example.py | 42 ++ ...ev_ops_operation_results_failed_example.py | 43 ++ ...ops_operation_results_succeeded_example.py | 43 ++ .../get_device_security_groups_example.py | 43 ++ ...olution_resource_group_location_example.py | 44 ++ ...security_solutions_subscription_example.py | 40 ++ ...solutions_subscription_location_example.py | 43 ++ ...e_information_protection_policy_example.py | 43 ++ .../get_external_security_solution_example.py | 43 ++ ...security_solutions_subscription_example.py | 40 ++ ...solutions_subscription_location_example.py | 42 ++ .../get_git_hub_owners_example.py | 43 ++ .../get_git_hub_repos_example.py | 44 ++ .../get_git_lab_groups_example.py | 43 ++ .../get_git_lab_projects_example.py | 44 ++ .../get_governance_assignment_example.py | 44 ++ .../get_governance_rule_example.py | 42 ++ ..._governance_rule_execute_status_example.py | 43 ++ .../get_health_reports_example.py | 43 ++ .../get_io_tsecurity_solution.py | 42 ++ .../get_io_tsecurity_solutions_list.py | 40 ++ ..._io_tsecurity_solutions_list_by_iot_hub.py | 40 ++ ...curity_solutions_list_by_iot_hub_and_rg.py | 42 ++ .../get_io_tsecurity_solutions_list_by_rg.py | 42 ++ ...ity_solutions_security_aggregated_alert.py | 43 ++ ...olutions_security_aggregated_alert_list.py | 43 ++ ..._tsecurity_solutions_security_analytics.py | 42 ++ ...urity_solutions_security_analytics_list.py | 42 ++ ...urity_solutions_security_recommendation.py | 43 ++ ..._solutions_security_recommendation_list.py | 43 ++ ..._access_policies_resource_group_example.py | 42 ++ ...olicies_resource_group_location_example.py | 43 ++ ...rk_access_policies_subscription_example.py | 40 ++ ..._policies_subscription_location_example.py | 42 ++ .../get_jit_network_access_policy_example.py | 43 ++ .../generated_samples/get_location_example.py | 41 ++ .../get_locations_example.py | 40 ++ .../get_malware_scan_example.py | 44 ++ ...anagement_group_governance_rule_example.py | 42 ++ ..._governance_rule_execute_status_example.py | 43 ++ .../get_mde_onboardings_example.py | 39 ++ .../generated_samples/get_operation_result.py | 41 ++ .../generated_samples/get_operation_status.py | 42 ++ ...t_pricing_by_name_cloud_posture_example.py | 42 ++ .../get_pricing_by_name_containers_example.py | 42 ++ .../get_pricing_by_name_dns_example.py | 42 ++ ...ricing_by_name_storage_accounts_example.py | 42 ++ ...ricing_by_name_virtual_machines_example.py | 42 ++ ...egulatory_compliance_assessment_example.py | 43 ++ ...tory_compliance_assessment_list_example.py | 43 ++ ...t_regulatory_compliance_control_example.py | 42 ++ ...ulatory_compliance_control_list_example.py | 42 ++ ..._regulatory_compliance_standard_example.py | 41 ++ ...latory_compliance_standard_list_example.py | 40 ++ ...urce_pricing_by_name_containers_example.py | 43 ++ ...ricing_by_name_virtual_machines_example.py | 43 ++ .../get_secure_scores_single_example.py | 41 ++ ..._security_connector_application_example.py | 43 ++ ...urity_connector_governance_rule_example.py | 43 ++ ..._governance_rule_execute_status_example.py | 44 ++ ...urity_connector_single_resource_example.py | 42 ++ ...urity_connectors_resource_group_example.py | 42 ++ ...ecurity_connectors_subscription_example.py | 40 ++ .../get_security_contact_example.py | 41 ++ ..._security_contacts_subscription_example.py | 40 ++ .../get_security_operator_by_name_example.py | 42 ++ ...ons_reference_data_subscription_example.py | 40 ++ ...ence_data_subscription_location_example.py | 42 ++ ...lutions_resource_group_location_example.py | 43 ++ ...security_solutions_subscription_example.py | 40 ++ .../get_sensitivity_settings_example.py | 39 ++ .../get_sensitivity_settings_list_example.py | 39 ++ ...erver_vulnerability_assessments_example.py | 44 ++ ...lnerability_assessments_setting_example.py | 42 ++ .../generated_samples/get_setting_example.py | 41 ++ .../generated_samples/get_settings_example.py | 40 ++ .../get_standard_assignment.py | 42 ++ .../generated_samples/get_standard_example.py | 42 ++ .../get_sub_assessment_example.py | 44 ++ ...et_task_resource_group_location_example.py | 43 ++ .../get_task_subscription_location_example.py | 42 ++ ...t_tasks_resource_group_location_example.py | 43 ++ .../get_tasks_subscription_example.py | 40 ++ ...get_tasks_subscription_location_example.py | 42 ++ .../generated_samples/get_topology_example.py | 43 ++ .../get_topology_subscription_example.py | 40 ++ ..._topology_subscription_location_example.py | 42 ++ .../get_workspace_setting_example.py | 41 ++ .../get_workspace_settings_example.py | 40 ++ ...tiate_jit_network_access_policy_example.py | 53 +++ .../list_assessments_example.py | 42 ++ .../list_assessments_metadata_example.py | 40 ++ ...sessments_metadata_subscription_example.py | 40 ++ .../list_assignments_example.py | 42 ++ ...st_available_azure_dev_ops_orgs_example.py | 42 ++ .../list_available_git_hub_owners_example.py | 42 ++ .../list_available_git_lab_groups_example.py | 42 ++ .../list_azure_dev_ops_orgs_example.py | 43 ++ .../list_azure_dev_ops_projects_example.py | 44 ++ .../list_azure_dev_ops_repos_example.py | 45 ++ ...erver_vulnerability_assessments_example.py | 45 ++ ...nt_group_custom_recommendations_example.py | 42 ++ ...nagement_group_governance_rules_example.py | 42 ++ ...gement_group_security_standards_example.py | 42 ++ ...security_connector_applications_example.py | 43 ++ ...onnector_custom_recommendations_example.py | 43 ++ ...rity_connector_governance_rules_example.py | 43 ++ ...ty_connector_security_standards_example.py | 43 ++ ...st_by_subscription_applications_example.py | 40 ++ ...ist_by_subscription_assignments_example.py | 40 ++ ...cription_custom_recommendations_example.py | 42 ++ ...y_subscription_governance_rules_example.py | 42 ++ ...subscription_security_standards_example.py | 42 ++ .../list_by_subscription_standards_example.py | 40 ++ .../list_compliance_results_example.py | 42 ++ ...t_defender_for_storage_settings_example.py | 43 ++ .../list_dev_ops_configurations_example.py | 43 ++ .../list_device_security_groups_example.py | 43 ++ .../list_git_hub_owners_example.py | 43 ++ .../list_git_hub_repos_example.py | 44 ++ .../list_git_lab_groups_example.py | 43 ++ .../list_git_lab_projects_example.py | 44 ++ .../list_git_lab_subgroups_example.py | 43 ++ .../list_governance_assignments_example.py | 43 ++ .../list_health_reports_example.py | 42 ++ ...information_protection_policies_example.py | 42 ++ .../list_mde_onboardings_example.py | 39 ++ .../list_operations_example.py | 40 ++ .../list_pricings_example.py | 41 ++ .../list_pricings_with_plan_filter_example.py | 41 ++ .../list_resource_pricings_example.py | 42 ++ ...ecure_score_control_definitions_example.py | 40 ++ ...ontrol_definitions_subscription_example.py | 41 ++ .../list_secure_score_controls_example.py | 40 ++ ...score_controls_for_name_builtin_example.py | 42 ++ ...ls_for_name_with_expand_builtin_example.py | 42 ++ .../list_secure_scores_example.py | 40 ++ .../list_security_operators_example.py | 42 ++ ...nerability_assessments_settings_example.py | 41 ++ .../list_standard_assignments.py | 43 ++ .../list_standards_example.py | 42 ++ .../list_sub_assessments_example.py | 43 ++ ...st_subscription_sub_assessments_example.py | 42 ++ .../patch_automation_example.py | 63 +++ .../patch_security_connector_example.py | 58 +++ .../post_governance_rule_example.py | 41 ++ ...tions_security_aggregated_alert_dismiss.py | 43 ++ ...anagement_group_governance_rule_example.py | 41 ++ ...urity_connector_governance_rule_example.py | 42 ++ ...e_endpoint_connections_create_or_update.py | 52 +++ .../private_endpoint_connections_delete.py | 42 ++ .../private_endpoint_connections_get.py | 43 ++ .../private_endpoint_connections_list.py | 43 ++ .../private_link_resources_get.py | 43 ++ ...ate_link_resources_list_by_private_link.py | 43 ++ .../generated_samples/private_links_create.py | 47 ++ .../generated_samples/private_links_delete.py | 41 ++ .../generated_samples/private_links_get.py | 42 ++ .../generated_samples/private_links_head.py | 42 ++ .../generated_samples/private_links_list.py | 42 ++ .../private_links_list_by_subscription.py | 40 ++ .../generated_samples/private_links_update.py | 45 ++ ...nced_threat_protection_settings_example.py | 48 +++ .../put_alerts_suppression_rule_example.py | 56 +++ .../put_application_example.py | 49 +++ .../put_assessment_example.py | 44 ++ .../put_assignment_example.py | 57 +++ .../put_automation_all_assessments_example.py | 66 +++ ...ation_high_severity_assessments_example.py | 82 ++++ ...ent_group_custom_recommendation_example.py | 54 +++ ...agement_group_security_standard_example.py | 55 +++ ...connector_custom_recommendation_example.py | 54 +++ ...ity_connector_security_standard_example.py | 54 +++ ...scription_custom_recommendation_example.py | 54 +++ ..._subscription_security_standard_example.py | 55 +++ .../put_default_assignment_example.py | 53 +++ ...t_defender_for_storage_settings_example.py | 64 +++ .../put_device_security_groups_example.py | 56 +++ .../put_disable_automation_example.py | 82 ++++ .../put_exemption_standard_assignment.py | 58 +++ .../put_governance_assignment_example.py | 57 +++ .../put_governance_rule_example.py | 71 ++++ ...anagement_group_governance_rule_example.py | 72 ++++ .../put_pricing_by_name_example.py | 43 ++ ...pricing_by_name_partial_success_example.py | 43 ++ .../put_pricing_vms_by_name_example.py | 43 ++ ..._pricing_by_name_containers_acr_example.py | 52 +++ ...urce_pricing_by_name_containers_example.py | 59 +++ ...ricing_by_name_virtual_machines_example.py | 44 ++ ..._security_connector_application_example.py | 51 +++ .../put_security_connector_example.py | 58 +++ ...urity_connector_governance_rule_example.py | 71 ++++ .../put_security_operator_by_name_example.py | 42 ++ .../put_sensitivity_settings_example.py | 49 +++ ...lnerability_assessments_setting_example.py | 46 ++ .../put_standard_assignment.py | 53 +++ .../generated_samples/put_standard_example.py | 54 +++ ...sql_managed_instance_baseline_rules_add.py | 42 ++ ..._managed_instance_baseline_rules_delete.py | 42 ++ ...sql_managed_instance_baseline_rules_get.py | 43 ++ ...ql_managed_instance_baseline_rules_list.py | 43 ++ ...sql_managed_instance_baseline_rules_put.py | 43 ++ ...l_sql_managed_instance_scan_results_get.py | 44 ++ ..._sql_managed_instance_scan_results_list.py | 44 ++ ...er_level_sql_managed_instance_scans_get.py | 43 ++ ...nstance_scans_get_scan_operation_result.py | 43 ++ ...ql_managed_instance_scans_initiate_scan.py | 42 ++ ...r_level_sql_managed_instance_scans_list.py | 43 ++ ...ver_level_sql_server_baseline_rules_add.py | 42 ++ ..._level_sql_server_baseline_rules_delete.py | 42 ++ ...ver_level_sql_server_baseline_rules_get.py | 43 ++ ...er_level_sql_server_baseline_rules_list.py | 43 ++ ...ver_level_sql_server_baseline_rules_put.py | 43 ++ ...erver_level_sql_server_scan_results_get.py | 44 ++ ...rver_level_sql_server_scan_results_list.py | 44 ++ .../server_level_sql_server_scans_get.py | 43 ++ ..._server_scans_get_scan_operation_result.py | 43 ++ ...er_level_sql_server_scans_initiate_scan.py | 42 ++ .../server_level_sql_server_scans_list.py | 43 ++ ...server_level_synapse_baseline_rules_add.py | 42 ++ ...ver_level_synapse_baseline_rules_delete.py | 42 ++ ...server_level_synapse_baseline_rules_get.py | 43 ++ ...erver_level_synapse_baseline_rules_list.py | 43 ++ ...server_level_synapse_baseline_rules_put.py | 43 ++ .../server_level_synapse_scan_results_get.py | 44 ++ .../server_level_synapse_scan_results_list.py | 44 ++ .../server_level_synapse_scans_get.py | 43 ++ ...synapse_scans_get_scan_operation_result.py | 43 ++ ...erver_level_synapse_scans_initiate_scan.py | 42 ++ .../server_level_synapse_scans_list.py | 43 ++ .../simulate_alerts_example.py | 56 +++ ...sql_managed_instance_baseline_rules_add.py | 42 ++ ..._managed_instance_baseline_rules_delete.py | 42 ++ ...sql_managed_instance_baseline_rules_get.py | 43 ++ ...ql_managed_instance_baseline_rules_list.py | 43 ++ ...sql_managed_instance_baseline_rules_put.py | 43 ++ .../sql_managed_instance_scan_results_get.py | 44 ++ .../sql_managed_instance_scan_results_list.py | 44 ++ .../sql_managed_instance_scans_get.py | 43 ++ ...nstance_scans_get_scan_operation_result.py | 43 ++ ...ql_managed_instance_scans_initiate_scan.py | 42 ++ .../sql_managed_instance_scans_list.py | 43 ++ .../sql_managed_instance_settings_delete.py | 41 ++ .../sql_managed_instance_settings_get.py | 42 ++ .../sql_managed_instance_settings_put.py | 42 ++ .../sql_server_baseline_rules_add.py | 42 ++ .../sql_server_baseline_rules_delete.py | 42 ++ .../sql_server_baseline_rules_get.py | 43 ++ .../sql_server_baseline_rules_list.py | 43 ++ .../sql_server_baseline_rules_put.py | 43 ++ .../sql_server_scan_results_get.py | 44 ++ .../sql_server_scan_results_list.py | 44 ++ .../generated_samples/sql_server_scans_get.py | 43 ++ ..._server_scans_get_scan_operation_result.py | 43 ++ .../sql_server_scans_initiate_scan.py | 42 ++ .../sql_server_scans_list.py | 43 ++ .../sql_server_settings_delete.py | 41 ++ .../sql_server_settings_get.py | 42 ++ .../sql_server_settings_put.py | 42 ++ .../start_malware_scan_example.py | 43 ++ .../synapse_baseline_rules_add.py | 42 ++ .../synapse_baseline_rules_delete.py | 42 ++ .../synapse_baseline_rules_get.py | 43 ++ .../synapse_baseline_rules_list.py | 43 ++ .../synapse_baseline_rules_put.py | 43 ++ .../synapse_scan_results_get.py | 44 ++ .../synapse_scan_results_list.py | 44 ++ .../generated_samples/synapse_scans_get.py | 43 ++ ...synapse_scans_get_scan_operation_result.py | 43 ++ .../synapse_scans_initiate_scan.py | 42 ++ .../generated_samples/synapse_scans_list.py | 43 ++ .../synapse_settings_delete.py | 41 ++ .../generated_samples/synapse_settings_get.py | 42 ++ .../generated_samples/synapse_settings_put.py | 42 ++ ...esource_group_location_activate_example.py | 42 ++ ...resource_group_location_dismiss_example.py | 42 ++ ...urce_group_location_in_progress_example.py | 42 ++ ...resource_group_location_resolve_example.py | 42 ++ ..._subscription_location_activate_example.py | 41 ++ ...t_subscription_location_dismiss_example.py | 41 ++ ...bscription_location_in_progress_example.py | 41 ++ ...t_subscription_location_resolve_example.py | 41 ++ .../update_azure_dev_ops_orgs_example.py | 46 ++ .../update_azure_dev_ops_projects_example.py | 47 ++ .../update_azure_dev_ops_repos_example.py | 48 +++ .../update_dev_ops_configurations_example.py | 54 +++ .../update_io_tsecurity_solution.py | 55 +++ .../update_setting_example.py | 42 ++ ...te_task_resource_group_location_example.py | 43 ++ ...date_task_subscription_location_example.py | 42 ++ .../update_workspace_setting_example.py | 48 +++ .../validate_automation_example.py | 81 ++++ .../virtual_machine_baseline_rules_add.py | 42 ++ .../virtual_machine_baseline_rules_delete.py | 42 ++ .../virtual_machine_baseline_rules_get.py | 43 ++ .../virtual_machine_baseline_rules_list.py | 43 ++ .../virtual_machine_baseline_rules_put.py | 43 ++ .../virtual_machine_scan_results_get.py | 44 ++ .../virtual_machine_scan_results_list.py | 44 ++ .../virtual_machine_scans_get.py | 43 ++ .../virtual_machine_scans_list.py | 43 ++ .../azure-mgmt-security/pyproject.toml | 3 +- .../azure-mgmt-security/tsp-location.yaml | 2 +- 422 files changed, 18421 insertions(+), 260 deletions(-) create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_get_by_azure_api_management_service_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_azure_api_management_service_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_offboard_azure_api_management_api_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/api_collections_onboard_azure_api_management_api_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/cancel_malware_scan_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_assessments_metadata_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_auto_provisioning_settings_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_git_hub_issues_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_io_tsecurity_solution.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_jit_network_access_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_orgs_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_only_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_selected_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_with_agentless_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_or_update_information_protection_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_security_contact_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_server_vulnerability_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/create_workspace_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_alerts_suppression_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_assessment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_assessments_metadata_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_automation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_dev_ops_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_device_security_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_governance_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_io_tsecurity_solution.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_jit_network_access_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_management_group_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_by_name_containers_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_security_contact_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_security_operator_by_name_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_standard_assignment.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/delete_workspace_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_advanced_threat_protection_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alert_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alert_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscriptions_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_with_alert_type_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_assessment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_assessment_with_expand_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_setting_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_settings_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_automation_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_automations_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_automations_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_orgs_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_compliance_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_compliance_results_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_compliances_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_custom_information_protection_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_defender_for_storage_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_agentless_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_capabilities_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_failed_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_succeeded_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_device_security_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solution_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_effective_information_protection_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_external_security_solution_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_git_hub_owners_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_git_hub_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_git_lab_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_git_lab_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_governance_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_execute_status_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_health_reports_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solution.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub_and_rg.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_rg.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_locations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_malware_scan_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_execute_status_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_mde_onboardings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_operation_status.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_cloud_posture_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_containers_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_dns_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_storage_accounts_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_virtual_machines_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_list_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_list_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_list_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_containers_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_virtual_machines_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_secure_scores_single_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connector_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_execute_status_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connector_single_resource_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_resource_group_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_contact_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_contacts_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_operator_by_name_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_list_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_standard_assignment.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_sub_assessment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_task_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_task_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_tasks_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_topology_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_workspace_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/get_workspace_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/initiate_jit_network_access_policy_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_assignments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_available_azure_dev_ops_orgs_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_available_git_hub_owners_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_available_git_lab_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_orgs_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_extended_resource_server_vulnerability_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_custom_recommendations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_governance_rules_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_security_standards_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_applications_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_custom_recommendations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_governance_rules_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_security_standards_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_applications_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_assignments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_custom_recommendations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_governance_rules_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_security_standards_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_standards_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_compliance_results_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_defender_for_storage_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_dev_ops_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_device_security_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_git_hub_owners_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_git_hub_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_git_lab_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_git_lab_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_git_lab_subgroups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_governance_assignments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_health_reports_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_information_protection_policies_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_mde_onboardings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_operations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_pricings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_pricings_with_plan_filter_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_resource_pricings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_subscription_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_builtin_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_with_expand_builtin_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_secure_scores_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_security_operators_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_server_vulnerability_assessments_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_standard_assignments.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_standards_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_sub_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/list_subscription_sub_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/patch_automation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/patch_security_connector_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/post_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/post_io_tsecurity_solutions_security_aggregated_alert_dismiss.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/post_management_group_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/post_security_connector_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_create_or_update.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_link_resources_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_link_resources_list_by_private_link.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_create.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_head.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_list_by_subscription.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/private_links_update.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_advanced_threat_protection_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_alerts_suppression_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_assessment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_automation_all_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_automation_high_severity_assessments_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_custom_recommendation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_security_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_default_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_defender_for_storage_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_device_security_groups_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_disable_automation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_exemption_standard_assignment.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_governance_assignment_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_management_group_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_partial_success_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_pricing_vms_by_name_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_acr_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_virtual_machines_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_security_connector_application_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_security_connector_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_security_connector_governance_rule_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_security_operator_by_name_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_sensitivity_settings_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_server_vulnerability_assessments_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_standard_assignment.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/put_standard_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/simulate_alerts_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/start_malware_scan_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get_scan_operation_result.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scans_initiate_scan.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_scans_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_settings_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_settings_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/synapse_settings_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_activate_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_dismiss_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_in_progress_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_resolve_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_activate_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_dismiss_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_in_progress_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_resolve_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_orgs_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_projects_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_repos_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_dev_ops_configurations_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_io_tsecurity_solution.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_task_resource_group_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_task_subscription_location_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/update_workspace_setting_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/validate_automation_example.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_add.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_delete.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_put.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_list.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_get.py create mode 100644 sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_list.py diff --git a/sdk/security/azure-mgmt-security/CHANGELOG.md b/sdk/security/azure-mgmt-security/CHANGELOG.md index 377185ba7f4a..689814991c13 100644 --- a/sdk/security/azure-mgmt-security/CHANGELOG.md +++ b/sdk/security/azure-mgmt-security/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 8.0.0b3 (2026-05-28) + +### Breaking Changes + + - Model `ServerVulnerabilityAssessmentsSetting` deleted or renamed its instance variable `properties` + - Model `Setting` deleted or renamed its instance variable `properties` + ## 8.0.0b2 (2026-05-11) ### Features Added diff --git a/sdk/security/azure-mgmt-security/_metadata.json b/sdk/security/azure-mgmt-security/_metadata.json index 85986bc7cf8f..ab941b3de9e2 100644 --- a/sdk/security/azure-mgmt-security/_metadata.json +++ b/sdk/security/azure-mgmt-security/_metadata.json @@ -33,8 +33,8 @@ "SubAssessmentsAPI": "2019-01-01-preview", "TasksAPI": "2015-06-01-preview" }, - "commit": "b09aeaa0830a9f5c42bf730aa04294b2b7766656", + "commit": "cb62053a18882dd258d9922be9770702b7ef6ac9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/security/resource-manager/Microsoft.Security/Security", - "emitterVersion": "0.61.3" + "emitterVersion": "0.62.1" } \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/apiview-properties.json b/sdk/security/azure-mgmt-security/apiview-properties.json index c66c334e79c3..0d7aaf2941cd 100644 --- a/sdk/security/azure-mgmt-security/apiview-properties.json +++ b/sdk/security/azure-mgmt-security/apiview-properties.json @@ -1062,5 +1062,6 @@ "azure.mgmt.security.aio.operations.SubAssessmentsOperations.list": "SubAssessmentsAPI.SecuritySubAssessments.list", "azure.mgmt.security.operations.SubAssessmentsOperations.list_all": "SubAssessmentsAPI.SubAssessmentsOperationGroup.listAll", "azure.mgmt.security.aio.operations.SubAssessmentsOperations.list_all": "SubAssessmentsAPI.SubAssessmentsOperationGroup.listAll" - } + }, + "CrossLanguageVersion": "8002992ade73" } \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_client.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_client.py index 4b42131d75bc..fb8cd26dd5b8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_client.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -98,6 +98,11 @@ WorkspaceSettingsOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/model_base.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/model_base.py index db24930fdca9..d725c55906d3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/model_base.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -585,6 +590,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -595,11 +833,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -619,9 +853,19 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: """Deserialize an XML element into a dict mapping rest field names to values. :param ET.Element element: The XML element to deserialize from. @@ -629,53 +873,89 @@ def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: :rtype: dict """ result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) existed_attr_keys: list[str] = [] - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) + result[rf._rest_name] = _deserialize(rf._type, item) # rest thing is additional properties for e in element: @@ -708,6 +988,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -1082,6 +1365,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -1094,6 +1378,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer @property def _class_type(self) -> typing.Any: @@ -1113,7 +1398,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1126,7 +1414,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1172,6 +1464,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1181,6 +1474,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1414,6 +1708,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/serialization.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/serialization.py index 81ec1de5922b..a088671e9c51 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/serialization.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -1401,7 +1405,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1415,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py index 35a1c7bec106..b7b0458abc22 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "8.0.0b3" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_client.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_client.py index d2d1bcadb143..4633b4c77f7d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_client.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,6 +98,11 @@ WorkspaceSettingsOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_operations.py index 5968f59abe80..c75037b058bc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_operations.py @@ -444,7 +444,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -852,7 +852,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -1188,7 +1188,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -1272,7 +1272,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -1865,7 +1865,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -1963,7 +1963,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -2699,7 +2699,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -2847,7 +2847,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -3425,7 +3425,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -3506,7 +3506,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -4060,7 +4060,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -4230,7 +4230,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -4647,7 +4647,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -5095,7 +5095,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -5584,7 +5584,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -5996,7 +5996,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -6303,7 +6303,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -6472,7 +6472,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -6829,7 +6829,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -7359,7 +7359,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -7602,7 +7602,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8181,7 +8181,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8775,7 +8775,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8950,7 +8950,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9133,7 +9133,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9333,7 +9333,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9915,7 +9915,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9996,7 +9996,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -10707,7 +10707,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -10972,7 +10972,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -11234,7 +11234,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -12117,7 +12117,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -12866,7 +12866,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13068,7 +13068,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13368,7 +13368,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13551,7 +13551,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13632,7 +13632,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13815,7 +13815,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13896,7 +13896,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14341,7 +14341,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14427,7 +14427,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14705,7 +14705,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14793,7 +14793,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14968,7 +14968,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -15349,7 +15349,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -15775,7 +15775,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16168,7 +16168,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16576,7 +16576,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16905,7 +16905,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -17371,7 +17371,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -17763,7 +17763,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18169,7 +18169,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18249,7 +18249,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18661,7 +18661,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18741,7 +18741,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18929,7 +18929,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19164,7 +19164,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19315,7 +19315,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19714,7 +19714,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19797,7 +19797,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19886,7 +19886,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20279,7 +20279,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20698,7 +20698,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -21311,7 +21311,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22304,7 +22304,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22391,7 +22391,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22580,7 +22580,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22834,7 +22834,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -23002,7 +23002,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -23979,7 +23979,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24063,7 +24063,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24231,7 +24231,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24339,7 +24339,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24425,7 +24425,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24523,7 +24523,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24605,7 +24605,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25589,7 +25589,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25782,7 +25782,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26270,7 +26270,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26351,7 +26351,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26928,7 +26928,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -27008,7 +27008,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -27914,14 +27914,10 @@ async def begin_initiate_scan( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.SqlVulnerabilityAssessmentScanOperationResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -28157,7 +28153,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -28338,7 +28334,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -28421,7 +28417,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py index bed7ea9e4dd3..6e809832bfed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py @@ -1221,17 +1221,13 @@ class Setting(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.security.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: any :ivar kind: the kind of the settings string. Required. Known values are: "DataExportSettings", "AlertSuppressionSetting", and "AlertSyncSettings". :vartype kind: str or ~azure.mgmt.security.models.SettingKind """ __mapping__: dict[str, _Model] = {} - properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The resource-specific properties for this resource.""" - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update"]) """the kind of the settings string. Required. Known values are: \"DataExportSettings\", \"AlertSuppressionSetting\", and \"AlertSyncSettings\".""" @@ -1240,7 +1236,6 @@ def __init__( self, *, kind: str, - properties: Optional[Any] = None, ) -> None: ... @overload @@ -4054,17 +4049,13 @@ class ServerVulnerabilityAssessmentsSetting(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.security.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: any :ivar kind: The kind of the server vulnerability assessments setting. Required. "AzureServersSetting" :vartype kind: str or ~azure.mgmt.security.models.ServerVulnerabilityAssessmentsSettingKind """ __mapping__: dict[str, _Model] = {} - properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The resource-specific properties for this resource.""" - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update"]) """The kind of the server vulnerability assessments setting. Required. \"AzureServersSetting\"""" @overload @@ -4072,7 +4063,6 @@ def __init__( self, *, kind: str, - properties: Optional[Any] = None, ) -> None: ... @overload diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_operations.py index 1cfec92d91bb..1888229d6578 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_operations.py @@ -7548,7 +7548,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -7956,7 +7956,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8292,7 +8292,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8376,7 +8376,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -8968,7 +8968,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9066,7 +9066,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9804,7 +9804,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -9952,7 +9952,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -10532,7 +10532,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -10613,7 +10613,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -11169,7 +11169,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -11339,7 +11339,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -11755,7 +11755,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -12203,7 +12203,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -12692,7 +12692,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13103,7 +13103,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13409,7 +13409,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13578,7 +13578,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -13934,7 +13934,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14466,7 +14466,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -14709,7 +14709,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -15289,7 +15289,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -15878,7 +15878,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16048,7 +16048,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16230,7 +16230,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -16430,7 +16430,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -17010,7 +17010,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -17091,7 +17091,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -17802,7 +17802,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18067,7 +18067,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -18329,7 +18329,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19205,7 +19205,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -19954,7 +19954,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20156,7 +20156,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20458,7 +20458,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20638,7 +20638,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20718,7 +20718,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20898,7 +20898,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -20978,7 +20978,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -21422,7 +21422,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -21507,7 +21507,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -21784,7 +21784,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -21871,7 +21871,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22046,7 +22046,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22429,7 +22429,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -22857,7 +22857,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -23251,7 +23251,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -23659,7 +23659,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -23988,7 +23988,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24454,7 +24454,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -24846,7 +24846,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25254,7 +25254,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25334,7 +25334,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25748,7 +25748,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -25828,7 +25828,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26016,7 +26016,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26249,7 +26249,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26400,7 +26400,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26799,7 +26799,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26882,7 +26882,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -26969,7 +26969,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -27362,7 +27362,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -27782,7 +27782,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -28394,7 +28394,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -29386,7 +29386,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -29472,7 +29472,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -29660,7 +29660,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -29914,7 +29914,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -30082,7 +30082,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31056,7 +31056,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31139,7 +31139,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31307,7 +31307,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31414,7 +31414,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31499,7 +31499,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31597,7 +31597,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -31679,7 +31679,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -32662,7 +32662,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -32855,7 +32855,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -33340,7 +33340,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -33420,7 +33420,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -33997,7 +33997,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -34077,7 +34077,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -34982,14 +34982,10 @@ def begin_initiate_scan( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.SqlVulnerabilityAssessmentScanOperationResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -35225,7 +35221,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -35405,7 +35401,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -35487,7 +35483,7 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) + _request = HttpRequest("GET", next_link, headers=_headers) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_get_by_azure_api_management_service_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_get_by_azure_api_management_service_example.py new file mode 100644 index 000000000000..90cdac2ea688 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_get_by_azure_api_management_service_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_get_by_azure_api_management_service_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.api_collections.get_by_azure_api_management_service( + resource_group_name="rg1", + service_name="apimService1", + api_id="echo-api", + ) + print(response) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_GetByAzureApiManagementService_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_azure_api_management_service_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_azure_api_management_service_example.py new file mode 100644 index 000000000000..89e64a8e8be9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_azure_api_management_service_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_list_by_azure_api_management_service_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.api_collections.list_by_azure_api_management_service( + resource_group_name="rg1", + service_name="apimService1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_ListByAzureApiManagementService_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_resource_group_example.py new file mode 100644 index 000000000000..e5043814ccb7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_list_by_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.api_collections.list_by_resource_group( + resource_group_name="rg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_ListByResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_subscription_example.py new file mode 100644 index 000000000000..e52b3c0b9e27 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_list_by_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_list_by_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.api_collections.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_ListBySubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_offboard_azure_api_management_api_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_offboard_azure_api_management_api_example.py new file mode 100644 index 000000000000..37b284aadd64 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_offboard_azure_api_management_api_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_offboard_azure_api_management_api_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.api_collections.offboard_azure_api_management_api( + resource_group_name="rg1", + service_name="apimService1", + api_id="echo-api", + ) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_OffboardAzureApiManagementApi_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/api_collections_onboard_azure_api_management_api_example.py b/sdk/security/azure-mgmt-security/generated_samples/api_collections_onboard_azure_api_management_api_example.py new file mode 100644 index 000000000000..405d0fc482a8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/api_collections_onboard_azure_api_management_api_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python api_collections_onboard_azure_api_management_api_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.api_collections.begin_onboard_azure_api_management_api( + resource_group_name="rg1", + service_name="apimService1", + api_id="echo-api", + ).result() + print(response) + + +# x-ms-original-file: 2023-11-15/ApiCollections/APICollections_OnboardAzureApiManagementApi_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_add.py new file mode 100644 index 000000000000..e445c4489d3a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_delete.py new file mode 100644 index 000000000000..b02c6e902641 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_get.py new file mode 100644 index 000000000000..5a3d41ff5f35 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_list.py new file mode 100644 index 000000000000..6e1d5e24310a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_put.py new file mode 100644 index 000000000000..27bf511cd57a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_get.py new file mode 100644 index 000000000000..47c7669e9114 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_list.py new file mode 100644 index 000000000000..d23a030e3fdd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_get.py new file mode 100644 index 000000000000..d25ba8661f7d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ArcMachineScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_list.py new file mode 100644 index 000000000000..dcb4037d7972 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/arc_machine_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python arc_machine_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ArcMachineScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/cancel_malware_scan_example.py b/sdk/security/azure-mgmt-security/generated_samples/cancel_malware_scan_example.py new file mode 100644 index 000000000000..76bdb46d1368 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/cancel_malware_scan_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python cancel_malware_scan_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.cancel_malware_scan( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + setting_name="current", + scan_id="latest", + ) + print(response) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/CancelMalwareScan_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_assessments_metadata_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_assessments_metadata_subscription_example.py new file mode 100644 index 000000000000..184b47e57b47 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_assessments_metadata_subscription_example.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_assessments_metadata_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments_metadata.create_in_subscription( + assessment_metadata_name="ca039e75-a276-4175-aebc-bcd41e4b14b7", + assessment_metadata={ + "properties": { + "assessmentType": "CustomerManaged", + "categories": ["Compute"], + "description": "Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities.", + "displayName": "Install endpoint protection solution on virtual machine scale sets", + "remediationDescription": 'To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set', + "severity": "Medium", + "threats": ["dataExfiltration", "dataSpillage", "maliciousInsider"], + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/CreateAssessmentsMetadata_subscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_auto_provisioning_settings_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_auto_provisioning_settings_subscription_example.py new file mode 100644 index 000000000000..c825cae7ccf5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_auto_provisioning_settings_subscription_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_auto_provisioning_settings_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.auto_provisioning_settings.create( + setting_name="default", + setting={"properties": {"autoProvision": "On"}}, + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_git_hub_issues_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_git_hub_issues_example.py new file mode 100644 index 000000000000..1ac014afc5c9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_git_hub_issues_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_git_hub_issues_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.git_hub_issues.begin_create( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + owner_name="myGitHubOwner", + repo_name="myGitHubRepo", + ).result() + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateGitHubIssues_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_io_tsecurity_solution.py b/sdk/security/azure-mgmt-security/generated_samples/create_io_tsecurity_solution.py new file mode 100644 index 000000000000..cbee29e65b58 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_io_tsecurity_solution.py @@ -0,0 +1,66 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_io_tsecurity_solution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.create_or_update( + resource_group_name="MyGroup", + solution_name="default", + iot_security_solution_data={ + "location": "East Us", + "properties": { + "disabledDataSources": [], + "displayName": "Solution Default", + "export": [], + "iotHubs": [ + "/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub" + ], + "recommendationsConfiguration": [ + {"recommendationType": "IoT_OpenPorts", "status": "Disabled"}, + {"recommendationType": "IoT_SharedCredentials", "status": "Disabled"}, + ], + "status": "Enabled", + "unmaskedIpLoggingStatus": "Enabled", + "userDefinedResources": { + "query": 'where type != "microsoft.devices/iothubs" | where name contains "iot"', + "querySubscriptions": ["075423e9-7d33-4166-8bdf-3920b04e3735"], + }, + "workspace": "/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1", + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/CreateIoTSecuritySolution.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_jit_network_access_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_jit_network_access_policy_example.py new file mode 100644 index 000000000000..fbf4d3ec4fa2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_jit_network_access_policy_example.py @@ -0,0 +1,93 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_jit_network_access_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.create_or_update( + resource_group_name="myRg1", + asc_location="westeurope", + jit_network_access_policy_name="default", + body={ + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default", + "kind": "Basic", + "location": "westeurope", + "name": "default", + "properties": { + "provisioningState": "Succeeded", + "requests": [ + { + "requestor": "barbara@contoso.com", + "startTimeUtc": "2018-05-17T08:06:45.5691611Z", + "virtualMachines": [ + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1", + "ports": [ + { + "allowedSourceAddressPrefix": "192.127.0.2", + "endTimeUtc": "2018-05-17T09:06:45.5691611Z", + "number": 3389, + "status": "Initiated", + "statusReason": "UserRequested", + } + ], + } + ], + } + ], + "virtualMachines": [ + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1", + "ports": [ + { + "allowedSourceAddressPrefix": "*", + "maxRequestAccessDuration": "PT3H", + "number": 22, + "protocol": "*", + }, + { + "allowedSourceAddressPrefix": "*", + "maxRequestAccessDuration": "PT3H", + "number": 3389, + "protocol": "*", + }, + ], + } + ], + }, + "type": "Microsoft.Security/locations/jitNetworkAccessPolicies", + }, + ) + print(response) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/CreateJitNetworkAccessPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_orgs_example.py new file mode 100644 index 000000000000..b38bef9a3e32 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_orgs_example.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_azure_dev_ops_orgs_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_orgs.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + azure_dev_ops_org={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsOrgs_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_projects_example.py new file mode 100644 index 000000000000..e29c8087879e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_projects_example.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_azure_dev_ops_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_projects.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + azure_dev_ops_project={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_repos_example.py new file mode 100644 index 000000000000..072b1c92cebc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_azure_dev_ops_repos_example.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_azure_dev_ops_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_repos.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + repo_name="myAzDevOpsRepo", + azure_dev_ops_repository={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py new file mode 100644 index 000000000000..121e5c88adc7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_dev_ops_configurations_onboard_current_and_future_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + dev_ops_configuration={ + "properties": {"authorization": {"code": "00000000000000000000"}, "autoDiscovery": "Enabled"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_only_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_only_example.py new file mode 100644 index 000000000000..5d8329db63cf --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_current_only_example.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_dev_ops_configurations_onboard_current_only_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + dev_ops_configuration={ + "properties": {"authorization": {"code": "00000000000000000000"}, "autoDiscovery": "Disabled"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentOnly_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_selected_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_selected_example.py new file mode 100644 index 000000000000..9ecb3cf0cbb2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_onboard_selected_example.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_dev_ops_configurations_onboard_selected_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + dev_ops_configuration={ + "properties": { + "authorization": {"code": "00000000000000000000"}, + "autoDiscovery": "Disabled", + "topLevelInventoryList": ["org1", "org2"], + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardSelected_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_with_agentless_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_with_agentless_configurations_example.py new file mode 100644 index 000000000000..e3c340141860 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_dev_ops_configurations_with_agentless_configurations_example.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_dev_ops_configurations_with_agentless_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.begin_create_or_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + dev_ops_configuration={ + "properties": { + "agentlessConfiguration": { + "agentlessAutoDiscovery": "Disabled", + "agentlessEnabled": "Enabled", + "inventoryList": [{"inventoryKind": "AzureDevOpsOrganization", "value": "org1"}], + "inventoryListType": "Inclusion", + "scanners": ["scanner1", "scanner2"], + }, + "authorization": {"code": "00000000000000000000"}, + "autoDiscovery": "Enabled", + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsWithAgentlessConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_or_update_information_protection_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_information_protection_policy_example.py new file mode 100644 index 000000000000..b8a35d39b493 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_or_update_information_protection_policy_example.py @@ -0,0 +1,74 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_or_update_information_protection_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.information_protection_policies.create_or_update( + scope="providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + information_protection_policy_name="custom", + information_protection_policy={ + "properties": { + "informationTypes": { + "3bf35491-99b8-41f2-86d5-c1200a7df658": { + "custom": True, + "displayName": "Custom", + "enabled": True, + "keywords": [{"canBeNumeric": True, "custom": True, "pattern": "%custom%"}], + "order": 1400, + "recommendedLabelId": "7aa516c7-5a53-4857-bc6e-6808c6acd542", + }, + "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": { + "custom": False, + "displayName": "Networking", + "enabled": True, + "keywords": [{"canBeNumeric": False, "custom": True, "pattern": "%networking%"}], + "order": 100, + "recommendedLabelId": "575739d2-3d53-4df0-9042-4c7772d5c7b1", + }, + }, + "labels": { + "1345da73-bc5a-4a8f-b7dd-3820eb713da8": {"displayName": "Public", "enabled": True, "order": 100}, + "575739d2-3d53-4df0-9042-4c7772d5c7b1": { + "displayName": "Confidential", + "enabled": True, + "order": 300, + }, + "7aa516c7-5a53-4857-bc6e-6808c6acd542": {"displayName": "General", "enabled": True, "order": 200}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_security_contact_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_security_contact_example.py new file mode 100644 index 000000000000..f50471a6401b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_security_contact_example.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_security_contact_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_contacts.create( + security_contact_name="default", + security_contact={ + "properties": { + "emails": "john@contoso.com;jane@contoso.com", + "isEnabled": True, + "notificationsByRole": {"roles": ["Owner"], "state": "On"}, + "notificationsSources": [ + {"minimalRiskLevel": "Critical", "sourceType": "AttackPath"}, + {"minimalSeverity": "Medium", "sourceType": "Alert"}, + ], + "phone": "(214)275-4038", + } + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/SecurityContacts/CreateSecurityContact_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_server_vulnerability_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_server_vulnerability_assessments_example.py new file mode 100644 index 000000000000..61c3d9b97042 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_server_vulnerability_assessments_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_server_vulnerability_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessment.create_or_update( + resource_group_name="rg1", + resource_namespace="Microsoft.Compute", + resource_type="virtualMachines", + resource_name="vm1", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/create_workspace_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/create_workspace_setting_example.py new file mode 100644 index 000000000000..664b68ece8a2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/create_workspace_setting_example.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python create_workspace_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workspace_settings.create( + workspace_setting_name="default", + workspace_setting={ + "properties": { + "scope": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "workspaceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace", + } + }, + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/WorkspaceSettings/CreateWorkspaceSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_alerts_suppression_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_alerts_suppression_rule_example.py new file mode 100644 index 000000000000..adfa32f14507 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_alerts_suppression_rule_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_alerts_suppression_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts_suppression_rules.delete( + alerts_suppression_rule_name="dismissIpAnomalyAlerts", + ) + + +# x-ms-original-file: 2019-01-01-preview/AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_application_example.py new file mode 100644 index 000000000000..23ed96da1ada --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_application_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.application.delete( + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2022-07-01-preview/Applications/DeleteApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_assessment_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_assessment_example.py new file mode 100644 index 000000000000..771397374b9f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_assessment_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_assessment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.assessments.delete( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + assessment_name="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + ) + + +# x-ms-original-file: 2025-05-04/Assessments/DeleteAssessment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_assessments_metadata_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_assessments_metadata_subscription_example.py new file mode 100644 index 000000000000..4976200ed48b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_assessments_metadata_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_assessments_metadata_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.assessments_metadata.delete_in_subscription( + assessment_metadata_name="ca039e75-a276-4175-aebc-bcd41e4b14b7", + ) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/DeleteAssessmentsMetadata_subscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_assignment_example.py new file mode 100644 index 000000000000..bb7405c0bf86 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_assignment_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.assignments.delete( + resource_group_name="myResourceGroup", + assignment_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + ) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/DeleteAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_automation_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_automation_example.py new file mode 100644 index 000000000000..e45d7d456929 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_automation_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_automation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.automations.delete( + resource_group_name="myRg", + automation_name="myAutomationName", + ) + + +# x-ms-original-file: 2023-12-01-preview/Automations/DeleteAutomation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_custom_recommendation_example.py new file mode 100644 index 000000000000..74867891c851 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_custom_recommendation_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_management_group_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.custom_recommendations.delete( + scope="providers/Microsoft.Management/managementGroups/contoso", + custom_recommendation_name="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/DeleteByManagementGroupCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_security_standard_example.py new file mode 100644 index 000000000000..3a0cefcea479 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_management_group_security_standard_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_management_group_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_standards.delete( + scope="providers/Microsoft.Management/managementGroups/contoso", + standard_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/DeleteByManagementGroupSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_custom_recommendation_example.py new file mode 100644 index 000000000000..6a1b0a4cf8e0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_custom_recommendation_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_security_connector_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.custom_recommendations.delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + custom_recommendation_name="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/DeleteBySecurityConnectorCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_security_standard_example.py new file mode 100644 index 000000000000..a662055031f8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_security_connector_security_standard_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_security_connector_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_standards.delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + standard_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/DeleteBySecurityConnectorSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_custom_recommendation_example.py new file mode 100644 index 000000000000..3a5be11399d8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_custom_recommendation_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_subscription_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.custom_recommendations.delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + custom_recommendation_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/DeleteBySubscriptionCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_security_standard_example.py new file mode 100644 index 000000000000..4b1c6c6f07ef --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_by_subscription_security_standard_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_by_subscription_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_standards.delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + standard_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/DeleteBySubscriptionSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_dev_ops_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_dev_ops_configurations_example.py new file mode 100644 index 000000000000..16cb25f4d8e4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_dev_ops_configurations_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_dev_ops_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.dev_ops_configurations.begin_delete( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ).result() + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/DeleteDevOpsConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_device_security_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_device_security_groups_example.py new file mode 100644 index 000000000000..02111fb05889 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_device_security_groups_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_device_security_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.device_security_groups.delete( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + device_security_group_name="samplesecuritygroup", + ) + + +# x-ms-original-file: 2019-08-01/DeviceSecurityGroups/DeleteDeviceSecurityGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_governance_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_governance_assignment_example.py new file mode 100644 index 000000000000..6baeff0480ef --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_governance_assignment_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_governance_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_assignments.delete( + scope="subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + assessment_name="6b9421dd-5555-2251-9b3d-2be58e2f82cd", + assignment_key="6634ff9f-127b-4bf2-8e6e-b1737f5e789c", + ) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceAssignments/DeleteGovernanceAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_governance_rule_example.py new file mode 100644 index 000000000000..0680ac3cf1bd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_governance_rule_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/DeleteGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_io_tsecurity_solution.py b/sdk/security/azure-mgmt-security/generated_samples/delete_io_tsecurity_solution.py new file mode 100644 index 000000000000..bcaef7066bd0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_io_tsecurity_solution.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_io_tsecurity_solution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.iot_security_solution.delete( + resource_group_name="MyGroup", + solution_name="default", + ) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/DeleteIoTSecuritySolution.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_jit_network_access_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_jit_network_access_policy_example.py new file mode 100644 index 000000000000..375bc6eba91f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_jit_network_access_policy_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_jit_network_access_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.jit_network_access_policies.delete( + resource_group_name="myRg1", + asc_location="westeurope", + jit_network_access_policy_name="default", + ) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/DeleteJitNetworkAccessPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_management_group_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_management_group_governance_rule_example.py new file mode 100644 index 000000000000..99b31d17bdf9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_management_group_governance_rule_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_management_group_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_delete( + scope="providers/Microsoft.Management/managementGroups/contoso", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/DeleteManagementGroupGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_by_name_containers_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_by_name_containers_example.py new file mode 100644 index 000000000000..8cdbd64c5efe --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_by_name_containers_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_resource_pricing_by_name_containers_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.pricings.delete( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/demo-containers-rg/providers/Microsoft.ContainerService/managedClusters/demo-aks-cluster", + pricing_name="Containers", + ) + + +# x-ms-original-file: 2024-01-01/Pricings/DeleteResourcePricingByNameContainers_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_example.py new file mode 100644 index 000000000000..631d86411f2d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_resource_pricing_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_resource_pricing_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.pricings.delete( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", + pricing_name="VirtualMachines", + ) + + +# x-ms-original-file: 2024-01-01/Pricings/DeleteResourcePricing_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_application_example.py new file mode 100644 index 000000000000..cab9425d0e07 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_application_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_security_connector_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_connector_application.delete( + resource_group_name="gcpResourceGroup", + security_connector_name="gcpconnector", + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2022-07-01-preview/Applications/DeleteSecurityConnectorApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_example.py new file mode 100644 index 000000000000..9021b07ad1ef --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_security_connector_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_connectors.delete( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/DeleteSecurityConnector_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_governance_rule_example.py new file mode 100644 index 000000000000..a98d8b68a333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_security_connector_governance_rule_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_security_connector_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_delete( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/DeleteSecurityConnectorGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_security_contact_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_security_contact_example.py new file mode 100644 index 000000000000..068c41d50806 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_security_contact_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_security_contact_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_contacts.delete( + security_contact_name="default", + ) + + +# x-ms-original-file: 2023-12-01-preview/SecurityContacts/DeleteSecurityContact_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_security_operator_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_security_operator_by_name_example.py new file mode 100644 index 000000000000..2f2d114daf06 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_security_operator_by_name_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_security_operator_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.security_operators.delete( + pricing_name="CloudPosture", + security_operator_name="DefenderCSPMSecurityOperator", + ) + + +# x-ms-original-file: 2023-01-01-preview/SecurityOperators/DeleteSecurityOperatorByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_example.py new file mode 100644 index 000000000000..d085589c0090 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_server_vulnerability_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.server_vulnerability_assessment.begin_delete( + resource_group_name="rg1", + resource_namespace="Microsoft.Compute", + resource_type="virtualMachines", + resource_name="vm1", + ).result() + + +# x-ms-original-file: 2020-01-01/ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_setting_example.py new file mode 100644 index 000000000000..242e41d0a10e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_server_vulnerability_assessments_setting_example.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_server_vulnerability_assessments_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.server_vulnerability_assessments_settings.delete( + setting_kind="azureServersSetting", + ) + + +# x-ms-original-file: 2023-05-01/ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_standard_assignment.py b/sdk/security/azure-mgmt-security/generated_samples/delete_standard_assignment.py new file mode 100644 index 000000000000..1959a8d6e649 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_standard_assignment.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_standard_assignment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.standard_assignments.delete( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + standard_assignment_name="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + + +# x-ms-original-file: 2024-08-01/StandardAssignments/DeleteStandardAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_standard_example.py new file mode 100644 index 000000000000..064e882b8d54 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_standard_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.standards.delete( + resource_group_name="myResourceGroup", + standard_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + ) + + +# x-ms-original-file: 2021-08-01-preview/Standards/DeleteStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/delete_workspace_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/delete_workspace_setting_example.py new file mode 100644 index 000000000000..ed8f2faab612 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/delete_workspace_setting_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python delete_workspace_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.workspace_settings.delete( + workspace_setting_name="default", + ) + + +# x-ms-original-file: 2017-08-01-preview/WorkspaceSettings/DeleteWorkspaceSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_advanced_threat_protection_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_advanced_threat_protection_settings_example.py new file mode 100644 index 000000000000..6b66875c0853 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_advanced_threat_protection_settings_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_advanced_threat_protection_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.advanced_threat_protection.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + ) + print(response) + + +# x-ms-original-file: 2019-01-01/AdvancedThreatProtection/GetAdvancedThreatProtectionSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alert_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alert_resource_group_location_example.py new file mode 100644 index 000000000000..8d04f6825e49 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alert_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alert_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.get_resource_group_level( + resource_group_name="myRg1", + asc_location="westeurope", + alert_name="2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", + ) + print(response) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alert_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alert_subscription_location_example.py new file mode 100644 index 000000000000..73253c28e0e5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alert_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alert_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.get_subscription_level( + asc_location="westeurope", + alert_name="2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", + ) + print(response) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_example.py new file mode 100644 index 000000000000..47a487860b06 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.list_by_resource_group( + resource_group_name="myRg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertsResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_location_example.py new file mode 100644 index 000000000000..7d1b1c42e179 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.list_resource_group_level_by_region( + asc_location="westeurope", + resource_group_name="myRg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertsResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscription_example.py new file mode 100644 index 000000000000..f4666ebc485b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.list() + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscriptions_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscriptions_location_example.py new file mode 100644 index 000000000000..0bc29dffe0f2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_subscriptions_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_subscriptions_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts.list_subscription_level_by_region( + asc_location="westeurope", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01/Alerts/GetAlertsSubscriptionsLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rule_example.py new file mode 100644 index 000000000000..c5be0e0595f5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rule_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_suppression_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts_suppression_rules.get( + alerts_suppression_rule_name="dismissIpAnomalyAlerts", + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/AlertsSuppressionRules/GetAlertsSuppressionRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_example.py new file mode 100644 index 000000000000..dcd073c67bc6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_suppression_rules_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts_suppression_rules.list() + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/AlertsSuppressionRules/GetAlertsSuppressionRules_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_with_alert_type_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_with_alert_type_example.py new file mode 100644 index 000000000000..b94c491427ed --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_alerts_suppression_rules_with_alert_type_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_alerts_suppression_rules_with_alert_type_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts_suppression_rules.list() + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_example.py new file mode 100644 index 000000000000..4f7fb640ad34 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_allowed_connections_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.allowed_connections.get( + resource_group_name="myResourceGroup", + asc_location="centralus", + connection_type="Internal", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/AllowedConnections/GetAllowedConnections_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_example.py new file mode 100644 index 000000000000..e0eaf245efce --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_allowed_connections_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.allowed_connections.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/AllowedConnections/GetAllowedConnectionsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_location_example.py new file mode 100644 index 000000000000..3108bd8b9999 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_allowed_connections_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_allowed_connections_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.allowed_connections.list_by_home_region( + asc_location="centralus", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/AllowedConnections/GetAllowedConnectionsSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_application_example.py new file mode 100644 index 000000000000..775922e7b000 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_application_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.application.get( + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + print(response) + + +# x-ms-original-file: 2022-07-01-preview/Applications/GetApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_assessment_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_assessment_example.py new file mode 100644 index 000000000000..ce418572c36c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_assessment_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_assessment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + assessment_name="21300918-b2e3-0346-785f-c77ff57d243b", + ) + print(response) + + +# x-ms-original-file: 2025-05-04/Assessments/GetAssessment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_assessment_with_expand_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_assessment_with_expand_example.py new file mode 100644 index 000000000000..5f5547b61d09 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_assessment_with_expand_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_assessment_with_expand_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + assessment_name="21300918-b2e3-0346-785f-c77ff57d243b", + ) + print(response) + + +# x-ms-original-file: 2025-05-04/Assessments/GetAssessmentWithExpand_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_example.py new file mode 100644 index 000000000000..474a4fff3854 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_assessments_metadata_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments_metadata.get( + assessment_metadata_name="21300918-b2e3-0346-785f-c77ff57d243b", + ) + print(response) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/GetAssessmentsMetadata_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_subscription_example.py new file mode 100644 index 000000000000..4c9d34ef3622 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_assessments_metadata_subscription_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_assessments_metadata_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments_metadata.get_in_subscription( + assessment_metadata_name="21300918-b2e3-0346-785f-c77ff57d243b", + ) + print(response) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/GetAssessmentsMetadata_subscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_assignment_example.py new file mode 100644 index 000000000000..3118c203e6c3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_assignment_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assignments.get( + resource_group_name="myResourceGroup", + assignment_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/GetAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_setting_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_setting_subscription_example.py new file mode 100644 index 000000000000..cc047b909a72 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_setting_subscription_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_auto_provisioning_setting_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.auto_provisioning_settings.get( + setting_name="default", + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_settings_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_settings_subscription_example.py new file mode 100644 index 000000000000..8f20c651d9b7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_auto_provisioning_settings_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_auto_provisioning_settings_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.auto_provisioning_settings.list() + for item in response: + print(item) + + +# x-ms-original-file: 2017-08-01-preview/AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_automation_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_automation_resource_group_example.py new file mode 100644 index 000000000000..a2032b67ed14 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_automation_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_automation_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.get( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/GetAutomationResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_automations_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_automations_resource_group_example.py new file mode 100644 index 000000000000..2d03b168e987 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_automations_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_automations_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.list_by_resource_group( + resource_group_name="exampleResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-12-01-preview/Automations/GetAutomationsResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_automations_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_automations_subscription_example.py new file mode 100644 index 000000000000..ad68d8c7d889 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_automations_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_automations_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.list() + for item in response: + print(item) + + +# x-ms-original-file: 2023-12-01-preview/Automations/GetAutomationsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_orgs_example.py new file mode 100644 index 000000000000..36313768bb80 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_orgs_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_azure_dev_ops_orgs_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_orgs.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetAzureDevOpsOrgs_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_projects_example.py new file mode 100644 index 000000000000..0e0acfa33fd4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_projects_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_azure_dev_ops_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_projects.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetAzureDevOpsProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_repos_example.py new file mode 100644 index 000000000000..3cd985ab2b5d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_azure_dev_ops_repos_example.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_azure_dev_ops_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_repos.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + repo_name="myAzDevOpsRepo", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetAzureDevOpsRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_custom_recommendation_example.py new file mode 100644 index 000000000000..15ae969be663 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_custom_recommendation_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_management_group_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.get( + scope="providers/Microsoft.Management/managementGroups/contoso", + custom_recommendation_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/GetByManagementGroupCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_security_standard_example.py new file mode 100644 index 000000000000..9074b20e8521 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_management_group_security_standard_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_management_group_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.get( + scope="providers/Microsoft.Management/managementGroups/contoso", + standard_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/GetByManagementGroupSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_custom_recommendation_example.py new file mode 100644 index 000000000000..86d8a45a7bdb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_custom_recommendation_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_security_connector_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + custom_recommendation_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/GetBySecurityConnectorCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_security_standard_example.py new file mode 100644 index 000000000000..dbd758c46c48 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_security_connector_security_standard_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_security_connector_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + standard_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/GetBySecurityConnectorSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_custom_recommendation_example.py new file mode 100644 index 000000000000..f1739a43ea81 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_custom_recommendation_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_subscription_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + custom_recommendation_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/GetBySubscriptionCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_security_standard_example.py new file mode 100644 index 000000000000..6326b501773c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_by_subscription_security_standard_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_by_subscription_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + standard_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/GetBySubscriptionSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_compliance_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_compliance_example.py new file mode 100644 index 000000000000..4a084701e7c6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_compliance_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_compliance_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.compliances.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + compliance_name="2018-01-01Z", + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/Compliances/GetCompliance_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_compliance_results_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_compliance_results_example.py new file mode 100644 index 000000000000..92762dccea19 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_compliance_results_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_compliance_results_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.compliance_results.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + compliance_result_name="DesignateMoreThanOneOwner", + ) + print(response) + + +# x-ms-original-file: 2017-08-01/ComplianceResults/GetComplianceResults_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_compliances_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_compliances_example.py new file mode 100644 index 000000000000..ef371e56aea8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_compliances_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_compliances_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.compliances.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2017-08-01-preview/Compliances/GetCompliances_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_custom_information_protection_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_custom_information_protection_policy_example.py new file mode 100644 index 000000000000..314c2f44db1d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_custom_information_protection_policy_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_custom_information_protection_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.information_protection_policies.get( + scope="providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + information_protection_policy_name="custom", + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_defender_for_storage_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_defender_for_storage_settings_example.py new file mode 100644 index 000000000000..e105b2bbe865 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_defender_for_storage_settings_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_defender_for_storage_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + setting_name="current", + ) + print(response) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/GetDefenderForStorageSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_example.py new file mode 100644 index 000000000000..b39300302351 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_dev_ops_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetDevOpsConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_agentless_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_agentless_configurations_example.py new file mode 100644 index 000000000000..8766af7243f7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_agentless_configurations_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_dev_ops_configurations_with_agentless_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetDevOpsConfigurationsWithAgentlessConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_capabilities_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_capabilities_example.py new file mode 100644 index 000000000000..745b208de925 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_configurations_with_capabilities_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_dev_ops_configurations_with_capabilities_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetDevOpsConfigurationsWithCapabilities_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_failed_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_failed_example.py new file mode 100644 index 000000000000..64a0cfc9ffb7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_failed_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_dev_ops_operation_results_failed_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_operation_results.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + operation_result_id="8d4caace-e7b3-4b3e-af99-73f76829ebcf", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetDevOpsOperationResultsFailed_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_succeeded_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_succeeded_example.py new file mode 100644 index 000000000000..2453625f2e85 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_dev_ops_operation_results_succeeded_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_dev_ops_operation_results_succeeded_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_operation_results.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + operation_result_id="4e826cf1-5c36-4808-a7d2-fb4f5170978b", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetDevOpsOperationResultsSucceeded_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_device_security_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_device_security_groups_example.py new file mode 100644 index 000000000000..c7f8719130e5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_device_security_groups_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_device_security_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.device_security_groups.get( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + device_security_group_name="samplesecuritygroup", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/DeviceSecurityGroups/GetDeviceSecurityGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solution_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solution_resource_group_location_example.py new file mode 100644 index 000000000000..f86547c8ab76 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solution_resource_group_location_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_discovered_security_solution_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.discovered_security_solutions.get( + resource_group_name="myRg2", + asc_location="centralus", + discovered_security_solution_name="paloalto7", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_example.py new file mode 100644 index 000000000000..8263d604ade6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_discovered_security_solutions_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.discovered_security_solutions.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_location_example.py new file mode 100644 index 000000000000..4d8212602c7e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_discovered_security_solutions_subscription_location_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_discovered_security_solutions_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.discovered_security_solutions.list_by_home_region( + asc_location="centralus", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_effective_information_protection_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_effective_information_protection_policy_example.py new file mode 100644 index 000000000000..943db3540ced --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_effective_information_protection_policy_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_effective_information_protection_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.information_protection_policies.get( + scope="providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + information_protection_policy_name="effective", + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/InformationProtectionPolicies/GetEffectiveInformationProtectionPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solution_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solution_example.py new file mode 100644 index 000000000000..03bd9c872cc4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solution_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_external_security_solution_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.external_security_solutions.get( + resource_group_name="defaultresourcegroup-eus", + asc_location="centralus", + external_security_solutions_name="aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/ExternalSecuritySolutions/GetExternalSecuritySolution_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_example.py new file mode 100644 index 000000000000..8d758713f353 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_external_security_solutions_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.external_security_solutions.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_location_example.py new file mode 100644 index 000000000000..a4a5aa59c966 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_external_security_solutions_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_external_security_solutions_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.external_security_solutions.list_by_home_region( + asc_location="centralus", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_owners_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_owners_example.py new file mode 100644 index 000000000000..fc7cf0f663cd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_owners_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_git_hub_owners_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_hub_owners.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + owner_name="myGitHubOwner", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetGitHubOwners_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_repos_example.py new file mode 100644 index 000000000000..a0b67452b36e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_git_hub_repos_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_git_hub_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_hub_repos.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + owner_name="myGitHubOwner", + repo_name="myGitHubRepo", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetGitHubRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_groups_example.py new file mode 100644 index 000000000000..f07a753ee727 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_groups_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_git_lab_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_groups.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + group_fq_name="myGitLabGroup$mySubGroup", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetGitLabGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_projects_example.py new file mode 100644 index 000000000000..7e7c521d2919 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_git_lab_projects_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_git_lab_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_projects.get( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + group_fq_name="myGitLabGroup$mySubGroup", + project_name="myGitLabProject", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/GetGitLabProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_governance_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_governance_assignment_example.py new file mode 100644 index 000000000000..167cb6c53fc5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_governance_assignment_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_governance_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_assignments.get( + scope="subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + assessment_name="6b9421dd-5555-2251-9b3d-2be58e2f82cd", + assignment_key="6634ff9f-127b-4bf2-8e6e-b1737f5e789c", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceAssignments/GetGovernanceAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_example.py new file mode 100644 index 000000000000..8200d8e97143 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_execute_status_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_execute_status_example.py new file mode 100644 index 000000000000..8a6bd3063a6f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_governance_rule_execute_status_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_governance_rule_execute_status_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.operation_results( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + operation_id="58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetGovernanceRuleExecuteStatus_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_health_reports_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_health_reports_example.py new file mode 100644 index 000000000000..4ba791ab7b38 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_health_reports_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_health_reports_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.health_reports.get( + resource_id="subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/E2E-IBB0WX/providers/Microsoft.Security/securityconnectors/AwsConnectorAllOfferings", + health_report_name="909c629a-bf39-4521-8e4f-10b443a0bc02", + ) + print(response) + + +# x-ms-original-file: 2023-05-01-preview/HealthReports/GetHealthReports_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solution.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solution.py new file mode 100644 index 000000000000..d71461b3d34a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solution.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.get( + resource_group_name="MyGroup", + solution_name="default", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/GetIoTSecuritySolution.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list.py new file mode 100644 index 000000000000..819799da8459 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/GetIoTSecuritySolutionsList.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub.py new file mode 100644 index 000000000000..34f9a2c83e96 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_list_by_iot_hub.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHub.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub_and_rg.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub_and_rg.py new file mode 100644 index 000000000000..88986781e5bd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_iot_hub_and_rg.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_list_by_iot_hub_and_rg.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.list_by_resource_group( + resource_group_name="MyRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHubAndRg.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_rg.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_rg.py new file mode 100644 index 000000000000..37343a42f207 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_list_by_rg.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_list_by_rg.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.list_by_resource_group( + resource_group_name="MyGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/GetIoTSecuritySolutionsListByRg.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert.py new file mode 100644 index 000000000000..53394df31d97 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_aggregated_alert.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solutions_analytics_aggregated_alert.get( + resource_group_name="MyGroup", + solution_name="default", + aggregated_alert_name="IoT_Bruteforce_Fail/2019-02-02", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert_list.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert_list.py new file mode 100644 index 000000000000..1ff59a84b2b7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_aggregated_alert_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_aggregated_alert_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solutions_analytics_aggregated_alert.list( + resource_group_name="MyGroup", + solution_name="default", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics.py new file mode 100644 index 000000000000..d28ead000a77 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_analytics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution_analytics.get( + resource_group_name="MyGroup", + solution_name="default", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics_list.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics_list.py new file mode 100644 index 000000000000..13190db7e75d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_analytics_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_analytics_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution_analytics.list( + resource_group_name="MyGroup", + solution_name="default", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation.py new file mode 100644 index 000000000000..a41e102dcdfc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_recommendation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solutions_analytics_recommendation.get( + resource_group_name="IoTEdgeResources", + solution_name="default", + aggregated_recommendation_name="OpenPortsOnDevice", + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation_list.py b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation_list.py new file mode 100644 index 000000000000..e3520406a86e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_io_tsecurity_solutions_security_recommendation_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_io_tsecurity_solutions_security_recommendation_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solutions_analytics_recommendation.list( + resource_group_name="IoTEdgeResources", + solution_name="default", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_example.py new file mode 100644 index 000000000000..3c0b0bddf460 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_jit_network_access_policies_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.list_by_resource_group( + resource_group_name="myRg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_location_example.py new file mode 100644 index 000000000000..1a1e1a36d3dd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_jit_network_access_policies_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.list_by_resource_group_and_region( + resource_group_name="myRg1", + asc_location="westeurope", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_example.py new file mode 100644 index 000000000000..76bcb30015ad --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_jit_network_access_policies_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_location_example.py new file mode 100644 index 000000000000..e10d2bbf061a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policies_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_jit_network_access_policies_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.list_by_region( + asc_location="westeurope", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policy_example.py new file mode 100644 index 000000000000..01a0b79ba9c4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_jit_network_access_policy_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_jit_network_access_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.get( + resource_group_name="myRg1", + asc_location="westeurope", + jit_network_access_policy_name="default", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/GetJitNetworkAccessPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_location_example.py new file mode 100644 index 000000000000..cd3b6af68f47 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_location_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.locations.get( + asc_location="centralus", + ) + print(response) + + +# x-ms-original-file: 2015-06-01-preview/Locations/GetLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_locations_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_locations_example.py new file mode 100644 index 000000000000..78595a04f417 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_locations_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_locations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.locations.list() + for item in response: + print(item) + + +# x-ms-original-file: 2015-06-01-preview/Locations/GetLocations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_malware_scan_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_malware_scan_example.py new file mode 100644 index 000000000000..bf4e31bb532e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_malware_scan_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_malware_scan_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.get_malware_scan( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + setting_name="current", + scan_id="latest", + ) + print(response) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/GetMalwareScan_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_example.py new file mode 100644 index 000000000000..bca4d688a70e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_management_group_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.get( + scope="providers/Microsoft.Management/managementGroups/contoso", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetManagementGroupGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_execute_status_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_execute_status_example.py new file mode 100644 index 000000000000..53db8c08504a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_management_group_governance_rule_execute_status_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_management_group_governance_rule_execute_status_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.operation_results( + scope="providers/Microsoft.Management/managementGroups/contoso", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + operation_id="58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetManagementGroupGovernanceRuleExecuteStatus_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_mde_onboardings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_mde_onboardings_example.py new file mode 100644 index 000000000000..b40d86b48b01 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_mde_onboardings_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_mde_onboardings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.mde_onboardings.get() + print(response) + + +# x-ms-original-file: 2021-10-01-preview/MdeOnboardings/GetMdeOnboardings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/get_operation_result.py new file mode 100644 index 000000000000..ba7eab71c69f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_operation_result.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.operation_results.get( + location="eastus", + operation_id="00000000-0000-0000-0000-000000000000", + ) + + +# x-ms-original-file: 2025-10-01-preview/OperationResults/GetOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_operation_status.py b/sdk/security/azure-mgmt-security/generated_samples/get_operation_status.py new file mode 100644 index 000000000000..d0030f7617ed --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_operation_status.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operation_statuses.get( + location="eastus", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2025-10-01-preview/OperationStatuses/GetOperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_cloud_posture_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_cloud_posture_example.py new file mode 100644 index 000000000000..9872620588fc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_cloud_posture_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_cloud_posture_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="CloudPosture", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetPricingByNameCloudPosture_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_containers_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_containers_example.py new file mode 100644 index 000000000000..a6ba1faa53b4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_containers_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_containers_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="Containers", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetPricingByNameContainers_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_dns_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_dns_example.py new file mode 100644 index 000000000000..21162537afa9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_dns_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_dns_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="Dns", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetPricingByNameDns_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_storage_accounts_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_storage_accounts_example.py new file mode 100644 index 000000000000..9c93efe054c4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_storage_accounts_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_storage_accounts_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="StorageAccounts", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetPricingByNameStorageAccounts_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_virtual_machines_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_virtual_machines_example.py new file mode 100644 index 000000000000..bca63c16e1e3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_pricing_by_name_virtual_machines_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_virtual_machines_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="VirtualMachines", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetPricingByNameVirtualMachines_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_example.py new file mode 100644 index 000000000000..6279411760f6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_assessment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_assessments.get( + regulatory_compliance_standard_name="PCI-DSS-3.2", + regulatory_compliance_control_name="1.1", + regulatory_compliance_assessment_name="968548cb-02b3-8cd2-11f8-0cf64ab1a347", + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_list_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_list_example.py new file mode 100644 index 000000000000..50e2323ec12d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_assessment_list_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_assessment_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_assessments.list( + regulatory_compliance_standard_name="PCI-DSS-3.2", + regulatory_compliance_control_name="1.1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_example.py new file mode 100644 index 000000000000..baa21d21c40e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_control_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_controls.get( + regulatory_compliance_standard_name="PCI-DSS-3.2", + regulatory_compliance_control_name="1.1", + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceControl_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_list_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_list_example.py new file mode 100644 index 000000000000..d89cd30ad185 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_control_list_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_control_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_controls.list( + regulatory_compliance_standard_name="PCI-DSS-3.2", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceControlList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_example.py new file mode 100644 index 000000000000..416766b32f22 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_standards.get( + regulatory_compliance_standard_name="PCI-DSS-3.2", + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_list_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_list_example.py new file mode 100644 index 000000000000..b276d9b4522a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_regulatory_compliance_standard_list_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_regulatory_compliance_standard_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.regulatory_compliance_standards.list() + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_containers_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_containers_example.py new file mode 100644 index 000000000000..c3d87418cca2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_containers_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_resource_pricing_by_name_containers_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/demo-containers-rg/providers/Microsoft.ContainerService/managedClusters/demo-aks-cluster", + pricing_name="Containers", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetResourcePricingByNameContainers_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_virtual_machines_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_virtual_machines_example.py new file mode 100644 index 000000000000..52bd08ddecf0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_resource_pricing_by_name_virtual_machines_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_resource_pricing_by_name_virtual_machines_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.get( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", + pricing_name="VirtualMachines", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/GetResourcePricingByNameVirtualMachines_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_secure_scores_single_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_secure_scores_single_example.py new file mode 100644 index 000000000000..03e2486d0433 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_secure_scores_single_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_secure_scores_single_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_scores.get( + secure_score_name="ascScore", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/secureScores/GetSecureScoresSingle_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_application_example.py new file mode 100644 index 000000000000..950ad6a131d2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_application_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connector_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connector_application.get( + resource_group_name="gcpResourceGroup", + security_connector_name="gcpconnector", + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + print(response) + + +# x-ms-original-file: 2022-07-01-preview/Applications/GetSecurityConnectorApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_example.py new file mode 100644 index 000000000000..fc89f3f77618 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connector_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.get( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_execute_status_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_execute_status_example.py new file mode 100644 index 000000000000..43239bbf83a7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_governance_rule_execute_status_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connector_governance_rule_execute_status_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.operation_results( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + operation_id="58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/GetSecurityConnectorGovernanceRuleExecuteStatus_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_single_resource_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_single_resource_example.py new file mode 100644 index 000000000000..c906430e9509 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connector_single_resource_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connector_single_resource_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connectors.get( + resource_group_name="exampleResourceGroup", + security_connector_name="exampleSecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/GetSecurityConnectorSingleResource_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_resource_group_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_resource_group_example.py new file mode 100644 index 000000000000..07fa14fc84da --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_resource_group_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connectors_resource_group_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connectors.list_by_resource_group( + resource_group_name="exampleResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_subscription_example.py new file mode 100644 index 000000000000..e2bba2ac4170 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_connectors_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_connectors_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connectors.list() + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/GetSecurityConnectorsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_contact_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_contact_example.py new file mode 100644 index 000000000000..701b105d6459 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_contact_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_contact_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_contacts.get( + security_contact_name="default", + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/SecurityContacts/GetSecurityContact_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_contacts_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_contacts_subscription_example.py new file mode 100644 index 000000000000..eaef8fbc6a13 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_contacts_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_contacts_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_contacts.list() + for item in response: + print(item) + + +# x-ms-original-file: 2023-12-01-preview/SecurityContacts/GetSecurityContactsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_operator_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_operator_by_name_example.py new file mode 100644 index 000000000000..5436e552b63a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_operator_by_name_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_operator_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_operators.get( + pricing_name="CloudPosture", + security_operator_name="DefenderCSPMSecurityOperator", + ) + print(response) + + +# x-ms-original-file: 2023-01-01-preview/SecurityOperators/GetSecurityOperatorByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_example.py new file mode 100644 index 000000000000..9c9a50917bee --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_example.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_solutions_reference_data_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_solutions_reference_data.list() + print(response) + + +# x-ms-original-file: 2020-01-01/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_location_example.py new file mode 100644 index 000000000000..0717f2eef5be --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_reference_data_subscription_location_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_solutions_reference_data_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_solutions_reference_data.list_by_home_region( + asc_location="westcentralus", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_resource_group_location_example.py new file mode 100644 index 000000000000..fca905a770ab --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_solutions_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_solutions.get( + resource_group_name="myRg2", + asc_location="centralus", + security_solution_name="paloalto7", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/SecuritySolutions/GetSecuritySolutionsResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_subscription_example.py new file mode 100644 index 000000000000..ee997fad0e7c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_security_solutions_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_security_solutions_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_solutions.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/SecuritySolutions/GetSecuritySolutionsSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_example.py new file mode 100644 index 000000000000..733db6647cc6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_sensitivity_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sensitivity_settings.get() + print(response) + + +# x-ms-original-file: 2023-02-15-preview/SensitivitySettings/GetSensitivitySettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_list_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_list_example.py new file mode 100644 index 000000000000..8457b06f8953 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_sensitivity_settings_list_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_sensitivity_settings_list_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sensitivity_settings.list() + print(response) + + +# x-ms-original-file: 2023-02-15-preview/SensitivitySettings/GetSensitivitySettingsList_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_example.py new file mode 100644 index 000000000000..5eba2656cc88 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_server_vulnerability_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessment.get( + resource_group_name="rg1", + resource_namespace="Microsoft.Compute", + resource_type="virtualMachines", + resource_name="vm1", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_setting_example.py new file mode 100644 index 000000000000..f1d093ed0322 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_server_vulnerability_assessments_setting_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_server_vulnerability_assessments_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessments_settings.get( + setting_kind="azureServersSetting", + ) + print(response) + + +# x-ms-original-file: 2023-05-01/ServerVulnerabilityAssessmentsSettings/GetServerVulnerabilityAssessmentsSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py new file mode 100644 index 000000000000..b0fffa879b0f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_setting_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.settings.get( + setting_name="WDATP", + ) + print(response) + + +# x-ms-original-file: 2022-05-01/Settings/GetSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py new file mode 100644 index 000000000000..dca7c8bb791c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_settings_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.settings.list() + for item in response: + print(item) + + +# x-ms-original-file: 2022-05-01/Settings/GetSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_standard_assignment.py b/sdk/security/azure-mgmt-security/generated_samples/get_standard_assignment.py new file mode 100644 index 000000000000..e9825579425f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_standard_assignment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_standard_assignment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standard_assignments.get( + resource_id="providers/Microsoft.Management/managementGroups/contoso", + standard_assignment_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + ) + print(response) + + +# x-ms-original-file: 2024-08-01/StandardAssignments/GetStandardAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_standard_example.py new file mode 100644 index 000000000000..b3f3b879f615 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_standard_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standards.get( + resource_group_name="myResourceGroup", + standard_id="21300918-b2e3-0346-785f-c77ff57d243b", + ) + print(response) + + +# x-ms-original-file: 2021-08-01-preview/Standards/GetStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_sub_assessment_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_sub_assessment_example.py new file mode 100644 index 000000000000..6175ee2d07ca --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_sub_assessment_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_sub_assessment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sub_assessments.get( + scope="subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2", + assessment_name="1195afff-c881-495e-9bc5-1486211ae03f", + sub_assessment_name="95f7da9c-a2a4-1322-0758-fcd24ef09b85", + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/SubAssessments/GetSubAssessment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_task_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_task_resource_group_location_example.py new file mode 100644 index 000000000000..b5ca34902d59 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_task_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_task_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tasks.get_resource_group_level_task( + resource_group_name="myRg", + asc_location="westeurope", + task_name="d55b4dc0-779c-c66c-33e5-d7bce24c4222", + ) + print(response) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/GetTaskResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_task_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_task_subscription_location_example.py new file mode 100644 index 000000000000..844556a6097d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_task_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_task_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tasks.get_subscription_level_task( + asc_location="westeurope", + task_name="62609ee7-d0a5-8616-9fe4-1df5cca7758d", + ) + print(response) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/GetTaskSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_tasks_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_resource_group_location_example.py new file mode 100644 index 000000000000..acfdd70f5b6e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_tasks_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tasks.list_by_resource_group( + resource_group_name="myRg", + asc_location="westeurope", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/GetTasksResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_example.py new file mode 100644 index 000000000000..fae3fe5adba0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_tasks_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tasks.list() + for item in response: + print(item) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/GetTasksSubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_location_example.py new file mode 100644 index 000000000000..1490c5e4a1aa --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_tasks_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_tasks_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.tasks.list_by_home_region( + asc_location="westeurope", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/GetTasksSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_topology_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_topology_example.py new file mode 100644 index 000000000000..954c25f8c440 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_topology_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_topology_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.topology.get( + resource_group_name="myservers", + asc_location="centralus", + topology_resource_name="vnets", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/Topology/GetTopology_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_example.py new file mode 100644 index 000000000000..707230b01b52 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_topology_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.topology.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/Topology/GetTopologySubscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_location_example.py new file mode 100644 index 000000000000..b1b97caec761 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_topology_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_topology_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.topology.list_by_home_region( + asc_location="centralus", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/Topology/GetTopologySubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_workspace_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_workspace_setting_example.py new file mode 100644 index 000000000000..a838cf80a4cc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_workspace_setting_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_workspace_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workspace_settings.get( + workspace_setting_name="default", + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/WorkspaceSettings/GetWorkspaceSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/get_workspace_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/get_workspace_settings_example.py new file mode 100644 index 000000000000..5baa96e9440b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/get_workspace_settings_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_workspace_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workspace_settings.list() + for item in response: + print(item) + + +# x-ms-original-file: 2017-08-01-preview/WorkspaceSettings/GetWorkspaceSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/initiate_jit_network_access_policy_example.py b/sdk/security/azure-mgmt-security/generated_samples/initiate_jit_network_access_policy_example.py new file mode 100644 index 000000000000..19ca577e4553 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/initiate_jit_network_access_policy_example.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python initiate_jit_network_access_policy_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.jit_network_access_policies.initiate( + resource_group_name="myRg1", + asc_location="westeurope", + jit_network_access_policy_name="default", + body={ + "justification": "testing a new version of the product", + "virtualMachines": [ + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1", + "ports": [{"allowedSourceAddressPrefix": "192.127.0.2", "duration": "PT1H", "number": 3389}], + } + ], + }, + ) + print(response) + + +# x-ms-original-file: 2020-01-01/JitNetworkAccessPolicies/InitiateJitNetworkAccessPolicy_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_example.py new file mode 100644 index 000000000000..537974e38f7f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-05-04/Assessments/ListAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_example.py new file mode 100644 index 000000000000..7b780538d3e4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_assessments_metadata_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments_metadata.list() + for item in response: + print(item) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/ListAssessmentsMetadata_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_subscription_example.py new file mode 100644 index 000000000000..e6f98992d62c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_assessments_metadata_subscription_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_assessments_metadata_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments_metadata.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2025-05-04/AssessmentsMetadata/ListAssessmentsMetadata_subscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_assignments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_assignments_example.py new file mode 100644 index 000000000000..a97eb52bb005 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_assignments_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_assignments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assignments.list( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/ListAssignments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_available_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_available_azure_dev_ops_orgs_example.py new file mode 100644 index 000000000000..190d4c4702b8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_available_azure_dev_ops_orgs_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_available_azure_dev_ops_orgs_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_orgs.list_available( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAvailableAzureDevOpsOrgs_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_available_git_hub_owners_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_available_git_hub_owners_example.py new file mode 100644 index 000000000000..77206ed83e30 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_available_git_hub_owners_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_available_git_hub_owners_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_hub_owners.list_available( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAvailableGitHubOwners_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_available_git_lab_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_available_git_lab_groups_example.py new file mode 100644 index 000000000000..0601de5d7f84 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_available_git_lab_groups_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_available_git_lab_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_groups.list_available( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAvailableGitLabGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_orgs_example.py new file mode 100644 index 000000000000..afee22c7e6a3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_orgs_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_azure_dev_ops_orgs_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_orgs.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAzureDevOpsOrgs_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_projects_example.py new file mode 100644 index 000000000000..9b91becee0bb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_projects_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_azure_dev_ops_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_projects.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAzureDevOpsProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_repos_example.py new file mode 100644 index 000000000000..cf877e930273 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_azure_dev_ops_repos_example.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_azure_dev_ops_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_repos.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListAzureDevOpsRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_extended_resource_server_vulnerability_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_extended_resource_server_vulnerability_assessments_example.py new file mode 100644 index 000000000000..54d36c646d9d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_extended_resource_server_vulnerability_assessments_example.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_extended_resource_server_vulnerability_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessment.list_by_extended_resource( + resource_group_name="rg1", + resource_namespace="Microsoft.Compute", + resource_type="virtualMachines", + resource_name="vm1", + ) + print(response) + + +# x-ms-original-file: 2020-01-01/ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_custom_recommendations_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_custom_recommendations_example.py new file mode 100644 index 000000000000..10f467b533ac --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_custom_recommendations_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_management_group_custom_recommendations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.list( + scope="providers/Microsoft.Management/managementGroups/contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/ListByManagementGroupCustomRecommendations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_governance_rules_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_governance_rules_example.py new file mode 100644 index 000000000000..0025b525d477 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_governance_rules_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_management_group_governance_rules_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.list( + scope="providers/Microsoft.Management/managementGroups/contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/ListByManagementGroupGovernanceRules_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_security_standards_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_security_standards_example.py new file mode 100644 index 000000000000..a86303662f07 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_management_group_security_standards_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_management_group_security_standards_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.list( + scope="providers/Microsoft.Management/managementGroups/contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/ListByManagementGroupSecurityStandards_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_applications_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_applications_example.py new file mode 100644 index 000000000000..a45a18a69c17 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_applications_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_security_connector_applications_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connector_applications.list( + resource_group_name="gcpResourceGroup", + security_connector_name="gcpconnector", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-07-01-preview/Applications/ListBySecurityConnectorApplications_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_custom_recommendations_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_custom_recommendations_example.py new file mode 100644 index 000000000000..42c98920e145 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_custom_recommendations_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_security_connector_custom_recommendations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/ListBySecurityConnectorCustomRecommendations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_governance_rules_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_governance_rules_example.py new file mode 100644 index 000000000000..d72253ac84f8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_governance_rules_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_security_connector_governance_rules_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/ListBySecurityConnectorGovernanceRules_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_security_standards_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_security_standards_example.py new file mode 100644 index 000000000000..590385077d50 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_security_connector_security_standards_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_security_connector_security_standards_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/ListBySecurityConnectorSecurityStandards_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_applications_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_applications_example.py new file mode 100644 index 000000000000..0b313dd7f80b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_applications_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_applications_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.applications.list() + for item in response: + print(item) + + +# x-ms-original-file: 2022-07-01-preview/Applications/ListBySubscriptionApplications_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_assignments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_assignments_example.py new file mode 100644 index 000000000000..17a7e40a921d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_assignments_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_assignments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assignments.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/ListBySubscriptionAssignments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_custom_recommendations_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_custom_recommendations_example.py new file mode 100644 index 000000000000..23d01c983b5c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_custom_recommendations_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_custom_recommendations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/ListBySubscriptionCustomRecommendations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_governance_rules_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_governance_rules_example.py new file mode 100644 index 000000000000..6e8959fe36e7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_governance_rules_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_governance_rules_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/ListBySubscriptionGovernanceRules_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_security_standards_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_security_standards_example.py new file mode 100644 index 000000000000..e60fe4230dc5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_security_standards_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_security_standards_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/ListBySubscriptionSecurityStandards_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_standards_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_standards_example.py new file mode 100644 index 000000000000..fdce6e64cec7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_by_subscription_standards_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_by_subscription_standards_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standards.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2021-08-01-preview/Standards/ListBySubscriptionStandards_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_compliance_results_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_compliance_results_example.py new file mode 100644 index 000000000000..493ecdd2a77a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_compliance_results_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_compliance_results_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.compliance_results.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2017-08-01/ComplianceResults/ListComplianceResults_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_defender_for_storage_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_defender_for_storage_settings_example.py new file mode 100644 index 000000000000..25e136e5e12d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_defender_for_storage_settings_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_defender_for_storage_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.list( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/ListDefenderForStorageSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_dev_ops_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_dev_ops_configurations_example.py new file mode 100644 index 000000000000..8111f3afb2ba --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_dev_ops_configurations_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_dev_ops_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListDevOpsConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_device_security_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_device_security_groups_example.py new file mode 100644 index 000000000000..97061b27e682 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_device_security_groups_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_device_security_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.device_security_groups.list( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-08-01/DeviceSecurityGroups/ListDeviceSecurityGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_owners_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_owners_example.py new file mode 100644 index 000000000000..cb75144e3522 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_owners_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_git_hub_owners_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_hub_owners.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListGitHubOwners_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_repos_example.py new file mode 100644 index 000000000000..774e5fe22a6b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_git_hub_repos_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_git_hub_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_hub_repos.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + owner_name="myGitHubOwner", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListGitHubRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_groups_example.py new file mode 100644 index 000000000000..007beb4ba857 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_groups_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_git_lab_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_groups.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListGitLabGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_projects_example.py new file mode 100644 index 000000000000..852adfe40225 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_projects_example.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_git_lab_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_projects.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + group_fq_name="myGitLabGroup$mySubGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListGitLabProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_subgroups_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_subgroups_example.py new file mode 100644 index 000000000000..c7db7a16f817 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_git_lab_subgroups_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_git_lab_subgroups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.git_lab_subgroups.list( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + group_fq_name="myGitLabGroup", + ) + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/ListGitLabSubgroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_governance_assignments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_governance_assignments_example.py new file mode 100644 index 000000000000..691e9f71f046 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_governance_assignments_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_governance_assignments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_assignments.list( + scope="subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd", + assessment_name="6b9421dd-5555-2251-9b3d-2be58e2f82cd", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceAssignments/ListGovernanceAssignments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_health_reports_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_health_reports_example.py new file mode 100644 index 000000000000..25678e5fe9ef --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_health_reports_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_health_reports_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.health_reports.list( + scope="subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-05-01-preview/HealthReports/ListHealthReports_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_information_protection_policies_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_information_protection_policies_example.py new file mode 100644 index 000000000000..8dd740807d53 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_information_protection_policies_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_information_protection_policies_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.information_protection_policies.list( + scope="providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2017-08-01-preview/InformationProtectionPolicies/ListInformationProtectionPolicies_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_mde_onboardings_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_mde_onboardings_example.py new file mode 100644 index 000000000000..54b61384b467 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_mde_onboardings_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_mde_onboardings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.mde_onboardings.list() + print(response) + + +# x-ms-original-file: 2021-10-01-preview/MdeOnboardings/ListMdeOnboardings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_operations_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_operations_example.py new file mode 100644 index 000000000000..fd4e6492da62 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_operations_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_operations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: 2025-10-01-preview/Operations/ListOperations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_pricings_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_pricings_example.py new file mode 100644 index 000000000000..d38a6d149cfd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_pricings_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_pricings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.list( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/ListPricings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_pricings_with_plan_filter_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_pricings_with_plan_filter_example.py new file mode 100644 index 000000000000..93df141f0f4b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_pricings_with_plan_filter_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_pricings_with_plan_filter_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.list( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/ListPricingsWithPlanFilter_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_resource_pricings_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_resource_pricings_example.py new file mode 100644 index 000000000000..bda5145edb99 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_resource_pricings_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_resource_pricings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.list( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/ListResourcePricings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_example.py new file mode 100644 index 000000000000..0ac56dc0127d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_score_control_definitions_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_score_control_definitions.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_subscription_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_subscription_example.py new file mode 100644 index 000000000000..773d83a0c725 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_control_definitions_subscription_example.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_score_control_definitions_subscription_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_score_control_definitions.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_example.py new file mode 100644 index 000000000000..a6ebafe26e94 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_score_controls_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_score_controls.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScores/ListSecureScoreControls_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_builtin_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_builtin_example.py new file mode 100644 index 000000000000..73cc8d29e6b8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_builtin_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_score_controls_for_name_builtin_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_score_controls.list_by_secure_score( + secure_score_name="ascScore", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScores/ListSecureScoreControlsForName_builtin_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_with_expand_builtin_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_with_expand_builtin_example.py new file mode 100644 index 000000000000..7fd35f90fa7a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_score_controls_for_name_with_expand_builtin_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_score_controls_for_name_with_expand_builtin_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_score_controls.list_by_secure_score( + secure_score_name="ascScore", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScores/ListSecureScoreControlsForNameWithExpand_builtin_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_secure_scores_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_secure_scores_example.py new file mode 100644 index 000000000000..9cec82910fc6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_secure_scores_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_secure_scores_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.secure_scores.list() + for item in response: + print(item) + + +# x-ms-original-file: 2020-01-01/secureScores/ListSecureScores_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_security_operators_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_security_operators_example.py new file mode 100644 index 000000000000..1e042c9dc05c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_security_operators_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_security_operators_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_operators.list( + pricing_name="CloudPosture", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-01-01-preview/SecurityOperators/ListSecurityOperators_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_server_vulnerability_assessments_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_server_vulnerability_assessments_settings_example.py new file mode 100644 index 000000000000..2f95cda00af7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_server_vulnerability_assessments_settings_example.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_server_vulnerability_assessments_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessments_settings.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2023-05-01/ServerVulnerabilityAssessmentsSettings/ListServerVulnerabilityAssessmentsSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_standard_assignments.py b/sdk/security/azure-mgmt-security/generated_samples/list_standard_assignments.py new file mode 100644 index 000000000000..12e2c767635c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_standard_assignments.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_standard_assignments.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standard_assignments.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2024-08-01/StandardAssignments/ListStandardAssignments.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_standards_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_standards_example.py new file mode 100644 index 000000000000..f5201bdf2d29 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_standards_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_standards_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standards.list( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2021-08-01-preview/Standards/ListStandards_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_sub_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_sub_assessments_example.py new file mode 100644 index 000000000000..5155a8fd2ae0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_sub_assessments_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_sub_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sub_assessments.list( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + assessment_name="82e20e14-edc5-4373-bfc4-f13121257c37", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/SubAssessments/ListSubAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/list_subscription_sub_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/list_subscription_sub_assessments_example.py new file mode 100644 index 000000000000..de6f91ac126e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/list_subscription_sub_assessments_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_subscription_sub_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sub_assessments.list_all( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2019-01-01-preview/SubAssessments/ListSubscriptionSubAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/patch_automation_example.py b/sdk/security/azure-mgmt-security/generated_samples/patch_automation_example.py new file mode 100644 index 000000000000..66b4fb96ebe8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/patch_automation_example.py @@ -0,0 +1,63 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python patch_automation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.update( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + automation={ + "properties": { + "actions": [ + { + "actionType": "LogicApp", + "logicAppResourceId": "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1", + "uri": "https://exampleTriggerUri1.com", + } + ], + "description": "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment", + "scopes": [ + { + "description": "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5", + "scopePath": "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup", + } + ], + "sources": [{"eventSource": "Assessments"}], + }, + "tags": {"Example": "exampleTag"}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/PatchAutomation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/patch_security_connector_example.py b/sdk/security/azure-mgmt-security/generated_samples/patch_security_connector_example.py new file mode 100644 index 000000000000..c81f6e0b0a04 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/patch_security_connector_example.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python patch_security_connector_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connectors.update( + resource_group_name="exampleResourceGroup", + security_connector_name="exampleSecurityConnectorName", + security_connector={ + "etag": "etag value (must be supplied for update)", + "location": "Central US", + "properties": { + "environmentData": {"environmentType": "AwsAccount"}, + "environmentName": "AWS", + "hierarchyIdentifier": "exampleHierarchyId", + "offerings": [ + { + "nativeCloudConnection": {"cloudRoleArn": "arn:aws:iam::00000000:role/ASCMonitor"}, + "offeringType": "CspmMonitorAws", + } + ], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/PatchSecurityConnector_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/post_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/post_governance_rule_example.py new file mode 100644 index 000000000000..32a1fbee42a0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/post_governance_rule_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python post_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_execute( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PostGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/post_io_tsecurity_solutions_security_aggregated_alert_dismiss.py b/sdk/security/azure-mgmt-security/generated_samples/post_io_tsecurity_solutions_security_aggregated_alert_dismiss.py new file mode 100644 index 000000000000..d6026ac6ecc0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/post_io_tsecurity_solutions_security_aggregated_alert_dismiss.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python post_io_tsecurity_solutions_security_aggregated_alert_dismiss.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.iot_security_solutions_analytics_aggregated_alert.dismiss( + resource_group_name="IoTEdgeResources", + solution_name="default", + aggregated_alert_name="IoT_Bruteforce_Fail/2019-02-02/dismiss", + ) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutionsAnalytics/PostIoTSecuritySolutionsSecurityAggregatedAlertDismiss.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/post_management_group_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/post_management_group_governance_rule_example.py new file mode 100644 index 000000000000..fda26a9c2d47 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/post_management_group_governance_rule_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python post_management_group_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_execute( + scope="providers/Microsoft.Management/managementGroups/contoso", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PostManagementGroupGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/post_security_connector_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/post_security_connector_governance_rule_example.py new file mode 100644 index 000000000000..8e53dca76378 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/post_security_connector_governance_rule_example.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python post_security_connector_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.governance_rules.begin_execute( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + ).result() + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PostSecurityConnectorGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_create_or_update.py b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_create_or_update.py new file mode 100644 index 000000000000..c8f87066c5c2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_create_or_update.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_endpoint_connections_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.begin_create_or_update( + resource_group_name="rg", + private_link_name="pls", + private_endpoint_connection_name="pe", + private_endpoint_connection={ + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "None", + "description": "Approved by administrator", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateEndpointConnections/PrivateEndpointConnections_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_delete.py b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_delete.py new file mode 100644 index 000000000000..b360b24a4b07 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_endpoint_connections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.private_endpoint_connections.begin_delete( + resource_group_name="rg", + private_link_name="pls", + private_endpoint_connection_name="pe", + ).result() + + +# x-ms-original-file: 2026-01-01/PrivateEndpointConnections/PrivateEndpointConnections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_get.py b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_get.py new file mode 100644 index 000000000000..81e91b4cb8e0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="rg", + private_link_name="pls", + private_endpoint_connection_name="pe", + ) + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateEndpointConnections/PrivateEndpointConnections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_list.py b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_list.py new file mode 100644 index 000000000000..5871185bc633 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_endpoint_connections_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_endpoint_connections_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="rg", + private_link_name="pls", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-01-01/PrivateEndpointConnections/PrivateEndpointConnections_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_get.py b/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_get.py new file mode 100644 index 000000000000..16f8ce44ef19 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_link_resources_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources.get( + resource_group_name="rg", + private_link_name="pls", + group_id="containers", + ) + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateLinkResources/PrivateLinkResources_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_list_by_private_link.py b/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_list_by_private_link.py new file mode 100644 index 000000000000..fd40093abceb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_link_resources_list_by_private_link.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_link_resources_list_by_private_link.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources.list( + resource_group_name="rg", + private_link_name="pls", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-01-01/PrivateLinkResources/PrivateLinkResources_ListByPrivateLink.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_create.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_create.py new file mode 100644 index 000000000000..e33d45a0ddec --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_create.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.begin_create( + resource_group_name="rg", + private_link_name="spl", + private_link={ + "location": "eastus", + "properties": {}, + "tags": {"environment": "production", "owner": "security-team", "project": "private-links"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_delete.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_delete.py new file mode 100644 index 000000000000..45993ccdf36b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.private_links.begin_delete( + resource_group_name="rg", + private_link_name="spl", + ).result() + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_get.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_get.py new file mode 100644 index 000000000000..f78196203a70 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.get( + resource_group_name="rg", + private_link_name="spl", + ) + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_head.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_head.py new file mode 100644 index 000000000000..e7ee459eb377 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_head.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_head.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.head( + resource_group_name="rg", + private_link_name="spl", + ) + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_list.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_list.py new file mode 100644 index 000000000000..31447c5b3035 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.list( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_list_by_subscription.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_list_by_subscription.py new file mode 100644 index 000000000000..a3eed08dfdd4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/private_links_update.py b/sdk/security/azure-mgmt-security/generated_samples/private_links_update.py new file mode 100644 index 000000000000..497de1cc74cc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/private_links_update.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python private_links_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_links.update( + resource_group_name="rg", + private_link_name="spl", + private_link={ + "tags": {"environment": "development", "owner": "security-team-updated", "project": "private-links"} + }, + ) + print(response) + + +# x-ms-original-file: 2026-01-01/PrivateLinks/PrivateLinks_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_advanced_threat_protection_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_advanced_threat_protection_settings_example.py new file mode 100644 index 000000000000..8cbabd521088 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_advanced_threat_protection_settings_example.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_advanced_threat_protection_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.advanced_threat_protection.create( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + advanced_threat_protection_setting={ + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/advancedThreatProtectionSettings/current", + "name": "current", + "properties": {"isEnabled": True}, + "type": "Microsoft.Security/advancedThreatProtectionSettings", + }, + ) + print(response) + + +# x-ms-original-file: 2019-01-01/AdvancedThreatProtection/PutAdvancedThreatProtectionSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_alerts_suppression_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_alerts_suppression_rule_example.py new file mode 100644 index 000000000000..1a134dc4f953 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_alerts_suppression_rule_example.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_alerts_suppression_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.alerts_suppression_rules.update( + alerts_suppression_rule_name="dismissIpAnomalyAlerts", + alerts_suppression_rule={ + "properties": { + "alertType": "IpAnomaly", + "comment": "Test VM", + "expirationDateUtc": "2019-12-01T19:50:47.083633Z", + "reason": "FalsePositive", + "state": "Enabled", + "suppressionAlertsScope": { + "allOf": [ + {"field": "entities.ip.address", "in": ["104.215.95.187", "52.164.206.56"]}, + {"contains": "POWERSHELL.EXE", "field": "entities.process.commandline"}, + ] + }, + } + }, + ) + print(response) + + +# x-ms-original-file: 2019-01-01-preview/AlertsSuppressionRules/PutAlertsSuppressionRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_application_example.py new file mode 100644 index 000000000000..2bb4086c7b17 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_application_example.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.application.create_or_update( + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + application={ + "properties": { + "conditionSets": [{"conditions": [{"operator": "contains", "property": "$.Id", "value": "-bil-"}]}], + "description": "An application on critical recommendations", + "displayName": "Admin's application", + "sourceResourceType": "Assessments", + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-07-01-preview/Applications/PutApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_assessment_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_assessment_example.py new file mode 100644 index 000000000000..bec736b05709 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_assessment_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_assessment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assessments.create_or_update( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", + assessment_name="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + assessment={"properties": {"resourceDetails": {"source": "Azure"}, "status": {"code": "Healthy"}}}, + ) + print(response) + + +# x-ms-original-file: 2025-05-04/Assessments/PutAssessment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_assignment_example.py new file mode 100644 index 000000000000..cab402386396 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_assignment_example.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assignments.create_or_update( + resource_group_name="myResourceGroup", + assignment_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + assignment={ + "properties": { + "additionalData": {"exemptionCategory": "waiver"}, + "assignedComponent": {"key": "1195afff-c881-495e-9bc5-1486211ae03f"}, + "assignedStandard": { + "id": "/providers/Microsoft.Security/Standards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8" + }, + "description": "Set of policies monitored by Azure Security Center for cross cloud", + "displayName": "ASC Default", + "effect": "Exempt", + "expiresOn": "2022-05-01T19:50:47.083633Z", + "metadata": {"ticketId": 12345}, + "scope": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/ResourceGroup/rg", + } + }, + ) + print(response) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/PutAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_automation_all_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_automation_all_assessments_example.py new file mode 100644 index 000000000000..fd0ae6050c63 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_automation_all_assessments_example.py @@ -0,0 +1,66 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_automation_all_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.create_or_update( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + automation={ + "etag": "etag value (must be supplied for update)", + "location": "Central US", + "properties": { + "actions": [ + { + "actionType": "LogicApp", + "logicAppResourceId": "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1", + "uri": "https://exampleTriggerUri1.com", + } + ], + "description": "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment", + "isEnabled": True, + "scopes": [ + { + "description": "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5", + "scopePath": "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup", + } + ], + "sources": [{"eventSource": "Assessments"}], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/PutAutomationAllAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_automation_high_severity_assessments_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_automation_high_severity_assessments_example.py new file mode 100644 index 000000000000..9f4446fb5ef5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_automation_high_severity_assessments_example.py @@ -0,0 +1,82 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_automation_high_severity_assessments_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.create_or_update( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + automation={ + "etag": "etag value (must be supplied for update)", + "location": "Central US", + "properties": { + "actions": [ + { + "actionType": "LogicApp", + "logicAppResourceId": "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1", + "uri": "https://exampleTriggerUri1.com", + } + ], + "description": "An example of a security automation that triggers one LogicApp resource (myTest1) on any high severity security assessment", + "isEnabled": True, + "scopes": [ + { + "description": "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5", + "scopePath": "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup", + } + ], + "sources": [ + { + "eventSource": "Assessments", + "ruleSets": [ + { + "rules": [ + { + "expectedValue": "High", + "operator": "Equals", + "propertyJPath": "properties.metadata.severity", + "propertyType": "String", + } + ] + } + ], + } + ], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/PutAutomationHighSeverityAssessments_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_custom_recommendation_example.py new file mode 100644 index 000000000000..9aca535f6e7d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_custom_recommendation_example.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_management_group_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.create_or_update( + scope="providers/Microsoft.Management/managementGroups/contoso", + custom_recommendation_name="33e7cc6e-a139-4723-a0e5-76993aee0771", + custom_recommendation_body={ + "properties": { + "cloudProviders": ["AWS"], + "description": "organization passwords policy", + "displayName": "Password Policy", + "query": "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')", + "remediationDescription": "Change password policy to...", + "securityIssue": "Vulnerability", + "severity": "Medium", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/PutByManagementGroupCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_security_standard_example.py new file mode 100644 index 000000000000..542069316f60 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_management_group_security_standard_example.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_management_group_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.create_or_update( + scope="providers/Microsoft.Management/managementGroups/contoso", + standard_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + standard={ + "properties": { + "assessments": [ + {"assessmentKey": "1195afff-c881-495e-9bc5-1486211ae03f"}, + {"assessmentKey": "dbd0cb49-b563-45e7-9724-889e799fa648"}, + ], + "cloudProviders": ["GCP"], + "description": "description of Azure Test Security Standard 1", + "displayName": "Azure Test Security Standard 1", + "policySetDefinitionId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Authorization/policySetDefinitions/patchorchestration-applicationversions", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/PutByManagementGroupSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_custom_recommendation_example.py new file mode 100644 index 000000000000..bc4604d5a9bc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_custom_recommendation_example.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_security_connector_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.create_or_update( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + custom_recommendation_name="33e7cc6e-a139-4723-a0e5-76993aee0771", + custom_recommendation_body={ + "properties": { + "cloudProviders": ["AWS"], + "description": "organization passwords policy", + "displayName": "Password Policy", + "query": "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')", + "remediationDescription": "Change password policy to...", + "securityIssue": "Vulnerability", + "severity": "Medium", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/PutBySecurityConnectorCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_security_standard_example.py new file mode 100644 index 000000000000..fd4c3430a2eb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_security_connector_security_standard_example.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_security_connector_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.create_or_update( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + standard_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + standard={ + "properties": { + "assessments": [ + {"assessmentKey": "1195afff-c881-495e-9bc5-1486211ae03f"}, + {"assessmentKey": "dbd0cb49-b563-45e7-9724-889e799fa648"}, + ], + "cloudProviders": ["GCP"], + "description": "description of Azure Test Security Standard 1", + "displayName": "Azure Test Security Standard 1", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/PutBySecurityConnectorSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_custom_recommendation_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_custom_recommendation_example.py new file mode 100644 index 000000000000..ba9dc46205fb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_custom_recommendation_example.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_subscription_custom_recommendation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.custom_recommendations.create_or_update( + scope="subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b", + custom_recommendation_name="33e7cc6e-a139-4723-a0e5-76993aee0771", + custom_recommendation_body={ + "properties": { + "cloudProviders": ["AWS"], + "description": "organization passwords policy", + "displayName": "Password Policy", + "query": "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')", + "remediationDescription": "Change password policy to...", + "securityIssue": "Vulnerability", + "severity": "Medium", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/CustomRecommendations/PutBySubscriptionCustomRecommendation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_security_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_security_standard_example.py new file mode 100644 index 000000000000..1ab7b316bc23 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_by_subscription_security_standard_example.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_by_subscription_security_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_standards.create_or_update( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + standard_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + standard={ + "properties": { + "assessments": [ + {"assessmentKey": "1195afff-c881-495e-9bc5-1486211ae03f"}, + {"assessmentKey": "dbd0cb49-b563-45e7-9724-889e799fa648"}, + ], + "cloudProviders": ["GCP"], + "description": "description of Azure Test Security Standard 1", + "displayName": "Azure Test Security Standard 1", + "policySetDefinitionId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Authorization/policySetDefinitions/patchorchestration-applicationversions", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/SecurityStandards/PutBySubscriptionSecurityStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_default_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_default_assignment_example.py new file mode 100644 index 000000000000..e2bf6a8977c6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_default_assignment_example.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_default_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.assignments.create_or_update( + resource_group_name="myResourceGroup", + assignment_id="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + assignment={ + "properties": { + "assignedStandard": { + "id": "/providers/Microsoft.Security/Standards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8" + }, + "description": "Set of policies monitored by Azure Security Center for cross cloud", + "displayName": "ASC Default", + "effect": "audit", + "scope": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/ResourceGroup/rg", + } + }, + ) + print(response) + + +# x-ms-original-file: 2021-08-01-preview/Assignments/PutDefaultAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_defender_for_storage_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_defender_for_storage_settings_example.py new file mode 100644 index 000000000000..078661330def --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_defender_for_storage_settings_example.py @@ -0,0 +1,64 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_defender_for_storage_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.create( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + setting_name="current", + defender_for_storage_setting={ + "properties": { + "isEnabled": True, + "malwareScanning": { + "automatedResponse": "BlobSoftDelete", + "blobScanResultsOptions": "BlobIndexTags", + "onUpload": { + "capGBPerMonth": 10000, + "filters": { + "excludeBlobsLargerThan": 1024, + "excludeBlobsWithPrefix": ["unscanned-container", "sample-container/logs"], + "excludeBlobsWithSuffix": [".log", ".jpg"], + }, + "isEnabled": True, + }, + "scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic", + }, + "overrideSubscriptionLevelSettings": True, + "sensitiveDataDiscovery": {"isEnabled": True}, + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/PutDefenderForStorageSettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_device_security_groups_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_device_security_groups_example.py new file mode 100644 index 000000000000..1de1adb6b7c0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_device_security_groups_example.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_device_security_groups_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.device_security_groups.create_or_update( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", + device_security_group_name="samplesecuritygroup", + device_security_group={ + "properties": { + "timeWindowRules": [ + { + "isEnabled": True, + "maxThreshold": 30, + "minThreshold": 0, + "ruleType": "ActiveConnectionsNotInAllowedRange", + "timeWindowSize": "PT05M", + } + ] + } + }, + ) + print(response) + + +# x-ms-original-file: 2019-08-01/DeviceSecurityGroups/PutDeviceSecurityGroups_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_disable_automation_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_disable_automation_example.py new file mode 100644 index 000000000000..3c276e06bc4f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_disable_automation_example.py @@ -0,0 +1,82 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_disable_automation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.create_or_update( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + automation={ + "etag": "etag value (must be supplied for update)", + "location": "Central US", + "properties": { + "actions": [ + { + "actionType": "LogicApp", + "logicAppResourceId": "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1", + "uri": "https://exampleTriggerUri1.com", + } + ], + "description": "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment", + "isEnabled": False, + "scopes": [ + { + "description": "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5", + "scopePath": "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup", + } + ], + "sources": [ + { + "eventSource": "Assessments", + "ruleSets": [ + { + "rules": [ + { + "expectedValue": "customAssessment", + "operator": "Equals", + "propertyJPath": "$.Entity.AssessmentType", + "propertyType": "String", + } + ] + } + ], + } + ], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/PutDisableAutomation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_exemption_standard_assignment.py b/sdk/security/azure-mgmt-security/generated_samples/put_exemption_standard_assignment.py new file mode 100644 index 000000000000..86a590ab1f3c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_exemption_standard_assignment.py @@ -0,0 +1,58 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_exemption_standard_assignment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standard_assignments.create( + resource_id="subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/ANAT_TEST_RG/providers/Microsoft.Compute/virtualMachines/anatTestE2LA", + standard_assignment_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + standard_assignment={ + "properties": { + "assignedStandard": { + "id": "/providers/Microsoft.Security/securityStandards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8" + }, + "description": "Exemption description", + "displayName": "Test exemption", + "effect": "Exempt", + "exemptionData": { + "assignedAssessment": {"assessmentKey": "1195afff-c881-495e-9bc5-1486211ae03f"}, + "exemptionCategory": "waiver", + }, + "expiresOn": "2022-05-01T19:50:47.083633Z", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/StandardAssignments/PutExemptionStandardAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_governance_assignment_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_governance_assignment_example.py new file mode 100644 index 000000000000..b00d01938b75 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_governance_assignment_example.py @@ -0,0 +1,57 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_governance_assignment_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_assignments.create_or_update( + scope="subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + assessment_name="6b9421dd-5555-2251-9b3d-2be58e2f82cd", + assignment_key="6634ff9f-127b-4bf2-8e6e-b1737f5e789c", + governance_assignment={ + "properties": { + "additionalData": {"ticketLink": "https://snow.com", "ticketNumber": 123123, "ticketStatus": "Active"}, + "governanceEmailNotification": { + "disableManagerEmailNotification": False, + "disableOwnerEmailNotification": False, + }, + "isGracePeriod": True, + "owner": "user@contoso.com", + "remediationDueDate": "2022-01-07T13:00:00.0000000Z", + "remediationEta": {"eta": "2022-01-08T13:00:00.0000000Z", "justification": "Justification of ETA"}, + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceAssignments/PutGovernanceAssignment_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_governance_rule_example.py new file mode 100644 index 000000000000..4e3c654a2442 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_governance_rule_example.py @@ -0,0 +1,71 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.create_or_update( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + governance_rule={ + "properties": { + "conditionSets": [ + { + "conditions": [ + { + "operator": "In", + "property": "$.AssessmentKey", + "value": '["b1cd27e0-4ecc-4246-939f-49c426d9d72f", "fe83f80b-073d-4ccf-93d9-6797eb870201"]', + } + ] + } + ], + "description": "A rule for critical recommendations", + "displayName": "Admin's rule", + "governanceEmailNotification": { + "disableManagerEmailNotification": False, + "disableOwnerEmailNotification": False, + }, + "isDisabled": False, + "isGracePeriod": True, + "ownerSource": {"type": "Manually", "value": "user@contoso.com"}, + "remediationTimeframe": "7.00:00:00", + "rulePriority": 200, + "ruleType": "Integrated", + "sourceResourceType": "Assessments", + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PutGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_management_group_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_management_group_governance_rule_example.py new file mode 100644 index 000000000000..810a8e1ccd45 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_management_group_governance_rule_example.py @@ -0,0 +1,72 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_management_group_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.create_or_update( + scope="providers/Microsoft.Management/managementGroups/contoso", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + governance_rule={ + "properties": { + "conditionSets": [ + { + "conditions": [ + { + "operator": "In", + "property": "$.AssessmentKey", + "value": '["b1cd27e0-4ecc-4246-939f-49c426d9d72f", "fe83f80b-073d-4ccf-93d9-6797eb870201"]', + } + ] + } + ], + "description": "A rule for a management group", + "displayName": "Management group rule", + "excludedScopes": ["/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"], + "governanceEmailNotification": { + "disableManagerEmailNotification": True, + "disableOwnerEmailNotification": False, + }, + "isDisabled": False, + "isGracePeriod": True, + "ownerSource": {"type": "Manually", "value": "user@contoso.com"}, + "remediationTimeframe": "7.00:00:00", + "rulePriority": 200, + "ruleType": "Integrated", + "sourceResourceType": "Assessments", + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PutManagementGroupGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_example.py new file mode 100644 index 000000000000..94cb9f095190 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_pricing_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="CloudPosture", + pricing={"properties": {"pricingTier": "Standard"}}, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutPricingByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_partial_success_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_partial_success_example.py new file mode 100644 index 000000000000..27769475783a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_by_name_partial_success_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_pricing_by_name_partial_success_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="CloudPosture", + pricing={"properties": {"pricingTier": "Standard"}}, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutPricingByNamePartialSuccess_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_pricing_vms_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_vms_by_name_example.py new file mode 100644 index 000000000000..f6f43bdb1f66 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_pricing_vms_by_name_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_pricing_vms_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + pricing_name="VirtualMachines", + pricing={"properties": {"enforce": "True", "pricingTier": "Standard", "subPlan": "P2"}}, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutPricingVMsByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_acr_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_acr_example.py new file mode 100644 index 000000000000..6e202cbd4dc0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_acr_example.py @@ -0,0 +1,52 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_resource_pricing_by_name_containers_acr_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myContainerRegistry", + pricing_name="Containers", + pricing={ + "properties": { + "extensions": [ + {"isEnabled": "True", "name": "ContainerRegistriesVulnerabilityAssessments"}, + {"isEnabled": "True", "name": "ContainerIntegrityContribution"}, + ], + "pricingTier": "Standard", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutResourcePricingByNameContainersACR_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_example.py new file mode 100644 index 000000000000..6630ebe83437 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_containers_example.py @@ -0,0 +1,59 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_resource_pricing_by_name_containers_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/demo-containers-rg/providers/Microsoft.ContainerService/managedClusters/demo-aks-cluster", + pricing_name="Containers", + pricing={ + "properties": { + "extensions": [ + {"isEnabled": "True", "name": "ContainerRegistriesVulnerabilityAssessments"}, + {"isEnabled": "True", "name": "ContainerSensor"}, + {"isEnabled": "True", "name": "AgentlessDiscoveryForKubernetes"}, + { + "additionalExtensionProperties": {"ExclusionTags": "[]"}, + "isEnabled": "True", + "name": "AgentlessVmScanning", + }, + {"isEnabled": "True", "name": "ContainerIntegrityContribution"}, + ], + "pricingTier": "Standard", + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutResourcePricingByNameContainers_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_virtual_machines_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_virtual_machines_example.py new file mode 100644 index 000000000000..40e56d62523b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_resource_pricing_by_name_virtual_machines_example.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_resource_pricing_by_name_virtual_machines_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pricings.update( + scope_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", + pricing_name="virtualMachines", + pricing={"properties": {"pricingTier": "Standard", "subPlan": "P1"}}, + ) + print(response) + + +# x-ms-original-file: 2024-01-01/Pricings/PutResourcePricingByNameVirtualMachines_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_application_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_application_example.py new file mode 100644 index 000000000000..f375d449d489 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_application_example.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_security_connector_application_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connector_application.create_or_update( + resource_group_name="gcpResourceGroup", + security_connector_name="gcpconnector", + application_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + application={ + "properties": { + "conditionSets": [{"conditions": [{"operator": "contains", "property": "$.Id", "value": "-prod-"}]}], + "description": "An application on critical GCP recommendations", + "displayName": "GCP Admin's application", + "sourceResourceType": "Assessments", + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-07-01-preview/Applications/PutSecurityConnectorApplication_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_example.py new file mode 100644 index 000000000000..3aa1a5a7b6bd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_example.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_security_connector_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_connectors.create_or_update( + resource_group_name="exampleResourceGroup", + security_connector_name="exampleSecurityConnectorName", + security_connector={ + "etag": "etag value (must be supplied for update)", + "location": "Central US", + "properties": { + "environmentData": {"environmentType": "AwsAccount", "scanInterval": 4}, + "environmentName": "AWS", + "hierarchyIdentifier": "exampleHierarchyId", + "offerings": [ + { + "nativeCloudConnection": {"cloudRoleArn": "arn:aws:iam::00000000:role/ASCMonitor"}, + "offeringType": "CspmMonitorAws", + } + ], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01-preview/SecurityConnectors/PutSecurityConnector_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_governance_rule_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_governance_rule_example.py new file mode 100644 index 000000000000..fc356a720f0c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_security_connector_governance_rule_example.py @@ -0,0 +1,71 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_security_connector_governance_rule_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.governance_rules.create_or_update( + scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + rule_id="ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + governance_rule={ + "properties": { + "conditionSets": [ + { + "conditions": [ + { + "operator": "In", + "property": "$.AssessmentKey", + "value": '["b1cd27e0-4ecc-4246-939f-49c426d9d72f", "fe83f80b-073d-4ccf-93d9-6797eb870201"]', + } + ] + } + ], + "description": "A rule on critical GCP recommendations", + "displayName": "GCP Admin's rule", + "governanceEmailNotification": { + "disableManagerEmailNotification": True, + "disableOwnerEmailNotification": False, + }, + "isDisabled": False, + "isGracePeriod": True, + "ownerSource": {"type": "Manually", "value": "user@contoso.com"}, + "remediationTimeframe": "7.00:00:00", + "rulePriority": 200, + "ruleType": "Integrated", + "sourceResourceType": "Assessments", + } + }, + ) + print(response) + + +# x-ms-original-file: 2022-01-01-preview/GovernanceRules/PutSecurityConnectorGovernanceRule_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_security_operator_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_security_operator_by_name_example.py new file mode 100644 index 000000000000..93d8e1648fa0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_security_operator_by_name_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_security_operator_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_operators.create_or_update( + pricing_name="CloudPosture", + security_operator_name="DefenderCSPMSecurityOperator", + ) + print(response) + + +# x-ms-original-file: 2023-01-01-preview/SecurityOperators/PutSecurityOperatorByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_sensitivity_settings_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_sensitivity_settings_example.py new file mode 100644 index 000000000000..979356b18eb3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_sensitivity_settings_example.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_sensitivity_settings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sensitivity_settings.create_or_update( + sensitivity_settings={ + "sensitiveInfoTypesIds": [ + "f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb", + "b452f22b-f87d-4f48-8490-ecf0873325b5", + "d59ee8b6-2618-404b-a5e7-aa377cd67543", + ], + "sensitivityThresholdLabelId": "f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb", + "sensitivityThresholdLabelOrder": 2, + }, + ) + print(response) + + +# x-ms-original-file: 2023-02-15-preview/SensitivitySettings/PutSensitivitySettings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_server_vulnerability_assessments_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_server_vulnerability_assessments_setting_example.py new file mode 100644 index 000000000000..7bc4a09fab76 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_server_vulnerability_assessments_setting_example.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_server_vulnerability_assessments_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.server_vulnerability_assessments_settings.create_or_update( + setting_kind="azureServersSetting", + server_vulnerability_assessments_setting={ + "kind": "AzureServersSetting", + "properties": {"selectedProvider": "MdeTvm"}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-05-01/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_standard_assignment.py b/sdk/security/azure-mgmt-security/generated_samples/put_standard_assignment.py new file mode 100644 index 000000000000..bd4a0e647184 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_standard_assignment.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_standard_assignment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standard_assignments.create( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + standard_assignment_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + standard_assignment={ + "properties": { + "assignedStandard": { + "id": "/providers/Microsoft.Security/securityStandards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8" + }, + "description": "Set of policies monitored by Azure Security Center for cross cloud", + "displayName": "ASC Default", + "effect": "Audit", + "excludedScopes": [], + } + }, + ) + print(response) + + +# x-ms-original-file: 2024-08-01/StandardAssignments/PutStandardAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/put_standard_example.py b/sdk/security/azure-mgmt-security/generated_samples/put_standard_example.py new file mode 100644 index 000000000000..4e281f2b272f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/put_standard_example.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_standard_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.standards.create_or_update( + resource_group_name="myResourceGroup", + standard_id="8bb8be0a-6010-4789-812f-e4d661c4ed0e", + standard={ + "properties": { + "category": "SecurityCenter", + "components": [ + {"key": "1195afff-c881-495e-9bc5-1486211ae03f"}, + {"key": "dbd0cb49-b563-45e7-9724-889e799fa648"}, + ], + "description": "description of Azure Test Security Standard 1", + "displayName": "Azure Test Security Standard 1", + "supportedClouds": ["GCP"], + } + }, + ) + print(response) + + +# x-ms-original-file: 2021-08-01-preview/Standards/PutStandard_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_add.py new file mode 100644 index 000000000000..9707d46cc929 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlManagedInstanceBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_delete.py new file mode 100644 index 000000000000..258364223ab0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlManagedInstanceBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_get.py new file mode 100644 index 000000000000..422c556c76d7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlManagedInstanceBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_list.py new file mode 100644 index 000000000000..6c937e34c08c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlManagedInstanceBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_put.py new file mode 100644 index 000000000000..49a22a399536 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlManagedInstanceBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_get.py new file mode 100644 index 000000000000..a6a574e369e3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SqlManagedInstanceScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_list.py new file mode 100644 index 000000000000..6b0ced4316b0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SqlManagedInstanceScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get.py new file mode 100644 index 000000000000..d4feb6f3c4e4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlManagedInstanceScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..2f0ae7a318fd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlManagedInstanceScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_initiate_scan.py new file mode 100644 index 000000000000..e623213d97c2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlManagedInstanceScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_list.py new file mode 100644 index 000000000000..d2e1db3ed53c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_managed_instance_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_managed_instance_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlManagedInstanceScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_add.py new file mode 100644 index 000000000000..e4f099b0c459 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlServerBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_delete.py new file mode 100644 index 000000000000..10deb38a3039 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlServerBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_get.py new file mode 100644 index 000000000000..4beb34598fb5 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlServerBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_list.py new file mode 100644 index 000000000000..f15d37ea2077 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlServerBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_put.py new file mode 100644 index 000000000000..3c1488dac00d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SqlServerBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_get.py new file mode 100644 index 000000000000..6f57989213d2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SqlServerScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_list.py new file mode 100644 index 000000000000..167f471598c0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SqlServerScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get.py new file mode 100644 index 000000000000..992473c4b19c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlServerScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..606a4fc5b9f2 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlServerScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_initiate_scan.py new file mode 100644 index 000000000000..30c1e69e74f3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlServerScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_list.py new file mode 100644 index 000000000000..a28e8e64e1e7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_sql_server_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_sql_server_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SqlServerScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_add.py new file mode 100644 index 000000000000..18b5f169f694 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SynapseBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_delete.py new file mode 100644 index 000000000000..18f3f5de6a86 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SynapseBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_get.py new file mode 100644 index 000000000000..8f773cf386af --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SynapseBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_list.py new file mode 100644 index 000000000000..7e0b65d9cc59 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SynapseBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_put.py new file mode 100644 index 000000000000..b6254b833c0e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/ServerLevel_SynapseBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_get.py new file mode 100644 index 000000000000..bbd43cdf5225 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SynapseScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_list.py new file mode 100644 index 000000000000..5dd0c7351fb9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/ServerLevel_SynapseScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get.py new file mode 100644 index 000000000000..afbf2584e982 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SynapseScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..f6409e3e6370 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SynapseScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_initiate_scan.py new file mode 100644 index 000000000000..b8a9d846eec0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SynapseScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_list.py new file mode 100644 index 000000000000..67cee505946f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/server_level_synapse_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python server_level_synapse_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/ServerLevel_SynapseScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/simulate_alerts_example.py b/sdk/security/azure-mgmt-security/generated_samples/simulate_alerts_example.py new file mode 100644 index 000000000000..d4ffc15f0b44 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/simulate_alerts_example.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python simulate_alerts_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.begin_simulate( + asc_location="centralus", + alert_simulator_request_body={ + "properties": { + "bundles": [ + "AppServices", + "DNS", + "KeyVaults", + "KubernetesService", + "ResourceManager", + "SqlServers", + "StorageAccounts", + "VirtualMachines", + "CosmosDbs", + ], + "kind": "Bundles", + } + }, + ).result() + + +# x-ms-original-file: 2022-01-01/Alerts/SimulateAlerts_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_add.py new file mode 100644 index 000000000000..d32a992459d6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlManagedInstanceBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_delete.py new file mode 100644 index 000000000000..bc40271ecc64 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlManagedInstanceBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_get.py new file mode 100644 index 000000000000..951f3541f521 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlManagedInstanceBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_list.py new file mode 100644 index 000000000000..a6255b3f68cc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlManagedInstanceBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_put.py new file mode 100644 index 000000000000..71313d971a4d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlManagedInstanceBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_get.py new file mode 100644 index 000000000000..87c0e3055d06 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SqlManagedInstanceScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_list.py new file mode 100644 index 000000000000..743119c3ae4b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SqlManagedInstanceScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get.py new file mode 100644 index 000000000000..dca2797bfd8b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlManagedInstanceScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..cc59507020e1 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlManagedInstanceScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_initiate_scan.py new file mode 100644 index 000000000000..03a45dca5936 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlManagedInstanceScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_list.py new file mode 100644 index 000000000000..6267506c817e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlManagedInstanceScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_delete.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_delete.py new file mode 100644 index 000000000000..c1404f260d1d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_delete.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_settings_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_settings.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlManagedInstanceSettings_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_get.py new file mode 100644 index 000000000000..47f6559d6804 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_get.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_settings_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlManagedInstanceSettings_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_put.py b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_put.py new file mode 100644 index 000000000000..b671b69c1c8a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_managed_instance_settings_put.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_managed_instance_settings_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/managedInstances/myManagedInstance", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlManagedInstanceSettings_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_add.py new file mode 100644 index 000000000000..640ebb7b6258 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlServerBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_delete.py new file mode 100644 index 000000000000..4a69c2035b05 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlServerBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_get.py new file mode 100644 index 000000000000..6f8fb2e58f32 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlServerBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_list.py new file mode 100644 index 000000000000..d8f70eafa236 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlServerBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_put.py new file mode 100644 index 000000000000..964fa93c0bb4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SqlServerBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_get.py new file mode 100644 index 000000000000..ad95323c2668 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SqlServerScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_list.py new file mode 100644 index 000000000000..a74c87421732 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SqlServerScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get.py new file mode 100644 index 000000000000..3f12eaa19326 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlServerScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..616929225633 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlServerScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_initiate_scan.py new file mode 100644 index 000000000000..5add8480f6e9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlServerScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_list.py new file mode 100644 index 000000000000..afb66e545c3b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer/databases/db", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SqlServerScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_delete.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_delete.py new file mode 100644 index 000000000000..8107167c8947 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_delete.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_settings_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_settings.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlServerSettings_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_get.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_get.py new file mode 100644 index 000000000000..c8d72f6b0b95 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_get.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_settings_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlServerSettings_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_put.py b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_put.py new file mode 100644 index 000000000000..6dab94ea3e97 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/sql_server_settings_put.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python sql_server_settings_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Sql/servers/myServer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SqlServerSettings_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/start_malware_scan_example.py b/sdk/security/azure-mgmt-security/generated_samples/start_malware_scan_example.py new file mode 100644 index 000000000000..0213dfbf42ab --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/start_malware_scan_example.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python start_malware_scan_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.defender_for_storage.start_malware_scan( + resource_id="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + setting_name="current", + ) + print(response) + + +# x-ms-original-file: 2025-09-01-preview/DefenderForStorage/StartMalwareScan_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_add.py new file mode 100644 index 000000000000..ae466393477e --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SynapseBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_delete.py new file mode 100644 index 000000000000..258404016091 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SynapseBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_get.py new file mode 100644 index 000000000000..87329a79b6c7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SynapseBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_list.py new file mode 100644 index 000000000000..ed1351a5c751 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SynapseBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_put.py new file mode 100644 index 000000000000..016fc77dfdb9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/SynapseBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_get.py new file mode 100644 index 000000000000..c9288ffd4007 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SynapseScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_list.py new file mode 100644 index 000000000000..aa218e864bae --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/SynapseScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get.py new file mode 100644 index 000000000000..d92df9b0afb8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SynapseScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get_scan_operation_result.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get_scan_operation_result.py new file mode 100644 index 000000000000..3d6da5022066 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_get_scan_operation_result.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scans_get_scan_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get_scan_operation_result( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/mySqlPool", + operation_id="11111111-2222-3333-4444-555555555555", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SynapseScans_GetScanOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_initiate_scan.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_initiate_scan.py new file mode 100644 index 000000000000..fcf604bfce6b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_initiate_scan.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scans_initiate_scan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.begin_initiate_scan( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SynapseScans_InitiateScan.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_list.py new file mode 100644 index 000000000000..4a47b843736a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace/sqlPools/myPool", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/SynapseScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_delete.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_delete.py new file mode 100644 index 000000000000..d249b3848fd7 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_delete.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_settings_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_settings.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SynapseSettings_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_get.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_get.py new file mode 100644 index 000000000000..3bac92ddf149 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_get.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_settings_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SynapseSettings_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_put.py b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_put.py new file mode 100644 index 000000000000..46a436f815e3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/synapse_settings_put.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python synapse_settings_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_settings.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Synapse/workspaces/myWorkspace", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsSettingsOperations/SynapseSettings_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_activate_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_activate_example.py new file mode 100644 index 000000000000..8b6049cb9645 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_activate_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_resource_group_location_activate_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_resource_group_level_state_to_activate( + resource_group_name="myRg2", + asc_location="westeurope", + alert_name="2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertResourceGroupLocation_activate_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_dismiss_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_dismiss_example.py new file mode 100644 index 000000000000..9cc49595ff12 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_dismiss_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_resource_group_location_dismiss_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_resource_group_level_state_to_dismiss( + resource_group_name="myRg2", + asc_location="westeurope", + alert_name="2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertResourceGroupLocation_dismiss_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_in_progress_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_in_progress_example.py new file mode 100644 index 000000000000..d238ea857721 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_in_progress_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_resource_group_location_in_progress_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_resource_group_level_state_to_in_progress( + resource_group_name="myRg2", + asc_location="westeurope", + alert_name="2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertResourceGroupLocation_inProgress_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_resolve_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_resolve_example.py new file mode 100644 index 000000000000..cb961da74878 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_resource_group_location_resolve_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_resource_group_location_resolve_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_resource_group_level_state_to_resolve( + resource_group_name="myRg2", + asc_location="westeurope", + alert_name="2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertResourceGroupLocation_resolve_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_activate_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_activate_example.py new file mode 100644 index 000000000000..2859b2dfe6ba --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_activate_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_subscription_location_activate_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_subscription_level_state_to_activate( + asc_location="westeurope", + alert_name="2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertSubscriptionLocation_activate_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_dismiss_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_dismiss_example.py new file mode 100644 index 000000000000..ad93296f7606 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_dismiss_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_subscription_location_dismiss_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_subscription_level_state_to_dismiss( + asc_location="westeurope", + alert_name="2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertSubscriptionLocation_dismiss_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_in_progress_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_in_progress_example.py new file mode 100644 index 000000000000..893d88d3950d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_in_progress_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_subscription_location_in_progress_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_subscription_level_state_to_in_progress( + asc_location="westeurope", + alert_name="2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertSubscriptionLocation_inProgress_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_resolve_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_resolve_example.py new file mode 100644 index 000000000000..d7378fe107de --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_alert_subscription_location_resolve_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_alert_subscription_location_resolve_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.alerts.update_subscription_level_state_to_resolve( + asc_location="westeurope", + alert_name="2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", + ) + + +# x-ms-original-file: 2022-01-01/Alerts/UpdateAlertSubscriptionLocation_resolve_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_orgs_example.py new file mode 100644 index 000000000000..ff67cd78d77c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_orgs_example.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_azure_dev_ops_orgs_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_orgs.begin_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + azure_dev_ops_org={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/UpdateAzureDevOpsOrgs_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_projects_example.py new file mode 100644 index 000000000000..fc3ccc3ddc75 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_projects_example.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_azure_dev_ops_projects_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_projects.begin_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + azure_dev_ops_project={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/UpdateAzureDevOpsProjects_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_repos_example.py new file mode 100644 index 000000000000..027f1c4eea81 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_azure_dev_ops_repos_example.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_azure_dev_ops_repos_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_dev_ops_repos.begin_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + org_name="myAzDevOpsOrg", + project_name="myAzDevOpsProject", + repo_name="myAzDevOpsRepo", + azure_dev_ops_repository={ + "properties": {"actionableRemediation": {"state": "Enabled"}, "onboardingState": "NotApplicable"} + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/UpdateAzureDevOpsRepos_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_dev_ops_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_dev_ops_configurations_example.py new file mode 100644 index 000000000000..ef06c3642534 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_dev_ops_configurations_example.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_dev_ops_configurations_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.dev_ops_configurations.begin_update( + resource_group_name="myRg", + security_connector_name="mySecurityConnectorName", + dev_ops_configuration={ + "properties": { + "agentlessConfiguration": { + "agentlessAutoDiscovery": "Disabled", + "agentlessEnabled": "Enabled", + "inventoryList": [{"inventoryKind": "AzureDevOpsOrganization", "value": "org1"}], + "inventoryListType": "Inclusion", + "scanners": ["scanner1", "scanner2"], + }, + "autoDiscovery": "Enabled", + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-11-01-preview/SecurityConnectorsDevOps/UpdateDevOpsConfigurations_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_io_tsecurity_solution.py b/sdk/security/azure-mgmt-security/generated_samples/update_io_tsecurity_solution.py new file mode 100644 index 000000000000..fcc0bec3f836 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_io_tsecurity_solution.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_io_tsecurity_solution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.iot_security_solution.update( + resource_group_name="myRg", + solution_name="default", + update_iot_security_solution_data={ + "properties": { + "recommendationsConfiguration": [ + {"recommendationType": "IoT_OpenPorts", "status": "Disabled"}, + {"recommendationType": "IoT_SharedCredentials", "status": "Disabled"}, + ], + "userDefinedResources": { + "query": 'where type != "microsoft.devices/iothubs" | where name contains "v2"', + "querySubscriptions": ["075423e9-7d33-4166-8bdf-3920b04e3735"], + }, + }, + "tags": {"foo": "bar"}, + }, + ) + print(response) + + +# x-ms-original-file: 2019-08-01/IoTSecuritySolutions/UpdateIoTSecuritySolution.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py new file mode 100644 index 000000000000..9be7904eb88d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_setting_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.settings.update( + setting_name="WDATP", + setting={"kind": "DataExportSettings", "properties": {"enabled": True}}, + ) + print(response) + + +# x-ms-original-file: 2022-05-01/Settings/UpdateSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_task_resource_group_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_task_resource_group_location_example.py new file mode 100644 index 000000000000..3752cdef5634 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_task_resource_group_location_example.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_task_resource_group_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.tasks.update_resource_group_level_task_state( + resource_group_name="myRg", + asc_location="westeurope", + task_name="d55b4dc0-779c-c66c-33e5-d7bce24c4222", + task_update_action_type="Dismiss", + ) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/UpdateTaskResourceGroupLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_task_subscription_location_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_task_subscription_location_example.py new file mode 100644 index 000000000000..77b1e4ab2b0a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_task_subscription_location_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_task_subscription_location_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.tasks.update_subscription_level_task_state( + asc_location="westeurope", + task_name="62609ee7-d0a5-8616-9fe4-1df5cca7758d", + task_update_action_type="Dismiss", + ) + + +# x-ms-original-file: 2015-06-01-preview/Tasks/UpdateTaskSubscriptionLocation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/update_workspace_setting_example.py b/sdk/security/azure-mgmt-security/generated_samples/update_workspace_setting_example.py new file mode 100644 index 000000000000..73870e002f5b --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/update_workspace_setting_example.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python update_workspace_setting_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workspace_settings.update( + workspace_setting_name="default", + workspace_setting={ + "properties": { + "scope": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "workspaceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace", + } + }, + ) + print(response) + + +# x-ms-original-file: 2017-08-01-preview/WorkspaceSettings/UpdateWorkspaceSetting_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/validate_automation_example.py b/sdk/security/azure-mgmt-security/generated_samples/validate_automation_example.py new file mode 100644 index 000000000000..98cdf8d8eb89 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/validate_automation_example.py @@ -0,0 +1,81 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python validate_automation_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.automations.validate( + resource_group_name="exampleResourceGroup", + automation_name="exampleAutomation", + automation={ + "location": "Central US", + "properties": { + "actions": [ + { + "actionType": "LogicApp", + "logicAppResourceId": "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1", + "uri": "https://exampleTriggerUri1.com", + } + ], + "description": "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment", + "isEnabled": True, + "scopes": [ + { + "description": "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5", + "scopePath": "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup", + } + ], + "sources": [ + { + "eventSource": "Assessments", + "ruleSets": [ + { + "rules": [ + { + "expectedValue": "customAssessment", + "operator": "Equals", + "propertyJPath": "$.Entity.AssessmentType", + "propertyType": "String", + } + ] + } + ], + } + ], + }, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: 2023-12-01-preview/Automations/ValidateAutomation_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_add.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_add.py new file mode 100644 index 000000000000..a2a46fd9116c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_add.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_baseline_rules_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.add( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/VirtualMachineBaselineRules_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_delete.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_delete.py new file mode 100644 index 000000000000..ad42d9cf56cd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_baseline_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.sql_vulnerability_assessment_baseline_rules.delete( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/VirtualMachineBaselineRules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_get.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_get.py new file mode 100644 index 000000000000..b27a13668fdc --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_baseline_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.get( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/VirtualMachineBaselineRules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_list.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_list.py new file mode 100644 index 000000000000..edf27c5f0a91 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_baseline_rules_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/VirtualMachineBaselineRules_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_put.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_put.py new file mode 100644 index 000000000000..6820d7105b59 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_baseline_rules_put.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_baseline_rules_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_baseline_rules.create_or_update( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + rule_id="VA1234", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsBaselineRuleOperations/VirtualMachineBaselineRules_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_get.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_get.py new file mode 100644 index 000000000000..6bb0f97c02d9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_scan_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.get( + scan_id="Scheduled-20200623", + scan_result_id="VA1234", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/VirtualMachineScanResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_list.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_list.py new file mode 100644 index 000000000000..bf3a6fc518fd --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scan_results_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_scan_results_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scan_results.list( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations/VirtualMachineScanResults_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_get.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_get.py new file mode 100644 index 000000000000..23fcbfb8c1ab --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_scans_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.get( + scan_id="Scheduled-20200623", + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/VirtualMachineScans_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_list.py b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_list.py new file mode 100644 index 000000000000..3e88f973ce3d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/virtual_machine_scans_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.security import SecurityManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python virtual_machine_scans_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sql_vulnerability_assessment_scans.list( + resource_id="subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.Compute/virtualMachines/myVm/sqlServers/server1/databases/master", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/sqlVulnerabilityAssessmentsScanOperations/VirtualMachineScans_List.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/pyproject.toml b/sdk/security/azure-mgmt-security/pyproject.toml index 8a733b4bc76c..13d4f2e183cd 100644 --- a/sdk/security/azure-mgmt-security/pyproject.toml +++ b/sdk/security/azure-mgmt-security/pyproject.toml @@ -17,13 +17,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", diff --git a/sdk/security/azure-mgmt-security/tsp-location.yaml b/sdk/security/azure-mgmt-security/tsp-location.yaml index 069e3a036bf8..fed6badf84ee 100644 --- a/sdk/security/azure-mgmt-security/tsp-location.yaml +++ b/sdk/security/azure-mgmt-security/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/security/resource-manager/Microsoft.Security/Security -commit: b09aeaa0830a9f5c42bf730aa04294b2b7766656 +commit: cb62053a18882dd258d9922be9770702b7ef6ac9 repo: Azure/azure-rest-api-specs additionalDirectories: