title: Configure diagnostic setting for azure database using Python SDK
body: <p>I want to configure diagnostic setting for Azure database using Python. I know that I have to use <a href="https://docs.microsoft.com/en-us/python/api/azure-mgmt-monitor/azure.mgmt.monitor.v2017_05_01_preview.operations.diagnosticsettingsoperations?view=azure-python" rel="nofollow noreferrer">DiagnosticSettingsOperations</a> Class, and <a href="https://docs.microsoft.com/en-us/python/api/azure-mgmt-monitor/azure.mgmt.monitor.v2017_05_01_preview.monitormanagementclient?view=azure-python" rel="nofollow noreferrer">MonitorManagementClient</a> Client, and <a href="https://docs.microsoft.com/en-us/python/api/azure-mgmt-monitor/azure.mgmt.monitor.v2017_05_01_preview.operations.diagnosticsettingsoperations?view=azure-python#create-or-update-resource-uri--name--parameters----kwargs-" rel="nofollow noreferrer">create_or_update</a> method to start. I am fairly new to Python development, and I am struggling to put the pieces together.</p>
  <p>However, there is no proper examples on what parameters to pass for the DiagnosticSettingsOperations Class.</p>
  <p>Sample code:</p>
  <pre><code>from azure.mgmt.monitor import MonitorManagementClient
  from azure.identity import ClientSecretCredential
  
  ####### FUNCTION TO CREATE AZURE AUTHENTICATION USING SERVICE PRINCIPAL #######
  def authenticateToAzureUsingServicePrincipal():
  
      # Authenticate to Azure using Service Principal credentials
      client_id = 'client_id'
      client_secret = 'client_secret'
      client_tenant_id = 'client_tenant_id'
  
      # Create Azure credential object
      servicePrincipalCredentialObject = ClientSecretCredential(tenant_id=client_tenant_id, client_id=client_id, client_secret=client_secret)
  
      return servicePrincipalCredentialObject
  
  
  azureCredential = authenticateToAzureUsingServicePrincipal()
  monitorManagerClient = MonitorManagementClient(azureCredential)
  </code></pre>
  <p>I want to configure Diagnostic setting for Azure sql database, which selects ALL Metrics and Logs by default and sends to a Log analytics workspace. Does anyone know how to proceed further?</p>