Uploading tables to Azure Blob Storage - KC7-Foundation/kc7 GitHub Wiki

You can generate a shared access token for Azure blob storage

Step1: Create a storage account

Step2: Create

image

Click on "containers" in the left menu and create a new blob storage container

Step3: Get the shared access token for your new storage container

Then run the following command to export your tables to Azure blob storage. These can be reimported by other later.


.export
  async compressed
  to csv (
    h@"https://storage1.blob.core.windows.net/containerName;secretKey""
  ) with (
    namePrefix="Email",
    includeHeaders="all",
    encoding ="UTF8NoBOM"
  )
  <| Email


.export
  async compressed
  to csv (
    h@"https://storage1.blob.core.windows.net/containerName;secretKey""
  ) with (
    namePrefix="Employees",
    includeHeaders="all",
    encoding ="UTF8NoBOM"
  )
  <| Employees


  .export
  async compressed
  to csv (
    h@"https://storage1.blob.core.windows.net/containerName;secretKey""
  ) with (
    namePrefix="FileCreationEvents",
    includeHeaders="all",
    encoding ="UTF8NoBOM"
  )
  <| FileCreationEvents

  .export
  async compressed
  to csv (
    h@"https://storage1.blob.core.windows.net/containerName;secretKey""
  ) with (
    namePrefix="OutboundBrowsing",
    includeHeaders="all",
    encoding ="UTF8NoBOM"
  )
  <| OutboundBrowsing


  .export
  async compressed
  to csv (
    h@"https://storage1.blob.core.windows.net/containerName;secretKey""
  ) with (
    namePrefix="PassiveDns",
    includeHeaders="all",
    encoding ="UTF8NoBOM"
  )
  <| PassiveDns



.show operation aeccb322-9bd4-451c-b078-75dae97ad626 details

Better yet use this query to create all the export commands

// List all tables in the database
.show tables 
// Generate export command for each table
| extend ExportCommand = strcat(".export async compressed to csv (h@'https://blobname.blob.core.windows.net/storagename",DatabaseName,"secretsnstuff') with (sizeLimit=1000000000, namePrefix='", DatabaseName,"_", TableName, "', includeHeaders='all', encoding='UTF8NoBOM') <| ", TableName)
// Display the table names, database names, and their corresponding export commands
| project TableName, DatabaseName, ExportCommand