Azure / azure-kusto-spark

Apache Spark Connector for Azure Kusto
Apache License 2.0
77 stars 34 forks source link

Added Managed Identity authentication #283

Closed asaharn closed 1 year ago

asaharn commented 1 year ago

Pull Request Description

managed identity authentication support


Breaking Changes:

Features:

Fixes:

Examples: 1) If System-assigned Managed Identity( no need to pass KUSTO_MANAGED_CLIENT_ID):

df.write
  .format("com.microsoft.kusto.spark.datasource")
      .format("com.microsoft.kusto.spark.datasource")
      .option(KustoSinkOptions.KUSTO_CLUSTER, "MyCluster")
      .option(KustoSinkOptions.KUSTO_DATABASE, "MyDatabase")
      .option(KustoSinkOptions.KUSTO_TABLE, "MyTable")
      .option(KustoSinkOptions.KUSTO_MANAGED_IDENTITY_AUTH, true.toString)
      .mode(SaveMode.Append)
      .save()

2) User-assigned Managed identity:

df.write
  .format("com.microsoft.kusto.spark.datasource")
      .format("com.microsoft.kusto.spark.datasource")
      .option(KustoSinkOptions.KUSTO_CLUSTER, "MyCluster")
      .option(KustoSinkOptions.KUSTO_DATABASE, "MyDatabase")
      .option(KustoSinkOptions.KUSTO_TABLE, "MyTable")
      .option(KustoSinkOptions.KUSTO_MANAGED_IDENTITY_AUTH, true.toString)
      .option(KustoSinkOptions.KUSTO_MANAGED_CLIENT_ID, "xxxx-xxxx-xxxxx-xxxx")
      .mode(SaveMode.Append)
      .save()
ag-ramachandran commented 1 year ago

Hello @asaharn, couple of quick checks a) Documentation needs to be added b) Samples of MI tests can be added in the PR