Skip to content

Commit d475c49

Browse files
lugoldbelugoldbe
authored andcommitted
cr fixes
1 parent 831ee46 commit d475c49

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

articles/data-explorer/end-to-end-csharp.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ var clientSecret = "xxxxxxxxxxxxxx";//Client Secret
4444
var subscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
4545
string location = "West Europe";
4646
string locationSmallCase = "westeurope";
47+
string azureResourceTemplatePath = @"xxxxxxxxx\template.json";//path to the Azure Resource Manager template json from the previous section
4748
48-
49-
string deploymentName = "e2eexa2";
49+
string deploymentName = "e2eexample";
5050
string resourceGroupName = deploymentName + "resourcegroup";
5151
string eventHubName = deploymentName + "eventhub";
5252
string eventHubNamespaceName = eventHubName + "ns";
@@ -69,7 +69,7 @@ await resourceManagementClient.ResourceGroups.CreateOrUpdateAsync(resourceGroupN
6969
Console.WriteLine(
7070
"Step 2: create a blob storage, a container in the storage account, an event hub, an azure data explorer cluster, and database by using an Azure Resource Manager template.");
7171
var parameters = $"{{\"eventHubNamespaceName\":{{\"value\":\"{eventHubNamespaceName}\"}},\"eventHubName\":{{\"value\":\"{eventHubName}\"}},\"storageAccountName\":{{\"value\":\"{storageAccountName}\"}},\"containerName\":{{\"value\":\"{storageContainerName}\"}},\"kustoClusterName\":{{\"value\":\"{kustoClusterName}\"}},\"kustoDatabaseName\":{{\"value\":\"{kustoDatabaseName}\"}}}}";
72-
string template = File.ReadAllText(@"C:\Users\lugoldbe\PycharmProjects\Test\template.json", Encoding.UTF8);
72+
string template = File.ReadAllText(azureResourceTemplatePath, Encoding.UTF8);
7373
await resourceManagementClient.Deployments.CreateOrUpdateAsync(resourceGroupName, deploymentName,
7474
new Deployment(new DeploymentProperties(DeploymentMode.Incremental, template: template,
7575
parameters: parameters)));
@@ -93,7 +93,7 @@ await eventGridClient.EventSubscriptions.CreateOrUpdateAsync(storageResourceId,
9393
}
9494
});
9595

96-
Console.WriteLine("Step 4: create a table and column mapping in Azure Data Explorer database.");
96+
Console.WriteLine("Step 4: create a table (with three columns, EventTime, EventId, and EventSummary) and column mapping in Azure Data Explorer database.");
9797
var kustoUri = $"https://{kustoClusterName}.{locationSmallCase}.kusto.windows.net";
9898
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
9999
{
@@ -130,7 +130,7 @@ using (var kustoClient = KustoClientFactory.CreateCslAdminProvider(kustoConnecti
130130
kustoClient.ExecuteControlCommand(command);
131131
}
132132

133-
Console.WriteLine("Step 5: add data connection.");
133+
Console.WriteLine("Step 5: add a event grid data connection. Azure Data Explorer will automatically ingest the data when new blobs are created.");
134134
var kustoManagementClient = new KustoManagementClient(serviceCreds)
135135
{
136136
SubscriptionId = subscriptionId

articles/data-explorer/end-to-end-python.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,10 @@ client_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
5858
#Client Secret
5959
client_secret = "xxxxxxxxxxxxxx"
6060
subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
61-
credentials = ServicePrincipalCredentials(
62-
client_id=client_id,
63-
secret=client_secret,
64-
tenant=tenant_id
65-
)
6661
location = "West Europe"
6762
location_small_case = "westeurope"
68-
63+
#path to the Azure Resource Manager template json from the previous section
64+
azure_resource_template_path = "xxxxxxxxx/template.json";
6965

7066
deployment_name = 'e2eexample'
7167
resource_group_name = deployment_name + "resourcegroup"
@@ -98,8 +94,7 @@ resource_client.resource_groups.create_or_update(
9894

9995
print('Step 2: create a blob storage, a container in the storage account, an event hub, an azure data explorer cluster, and database by using an Azure Resource Manager template.')
10096
#Read the Azure Resource Manager template
101-
template_path = os.path.join(os.path.dirname(__file__), 'template.json')
102-
with open(template_path, 'r') as template_file_fd:
97+
with open(azure_resource_template_path, 'r') as template_file_fd:
10398
template = json.load(template_file_fd)
10499

105100
parameters = {
@@ -117,6 +112,7 @@ deployment_properties = {
117112
'parameters': parameters
118113
}
119114

115+
#Returns an instance of LROPoller, see https://docs.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
120116
poller = resource_client.deployments.create_or_update(
121117
resource_group_name,
122118
deployment_name,
@@ -143,7 +139,7 @@ event_client.event_subscriptions.create_or_update(storage_resource_id, event_gri
143139
})
144140

145141

146-
print('Step 4: create a table and column mapping in Azure Data Explorer database.')
142+
print('Step 4: create a table (with three columns, EventTime, EventId, and EventSummary) and column mapping in Azure Data Explorer database.')
147143
kusto_uri = "https://{}.{}.kusto.windows.net".format(kusto_cluster_name, location_small_case)
148144
database_name = kusto_database_name
149145
kusto_connection_string_builder = KustoConnectionStringBuilder.with_aad_application_key_authentication(connection_string=kusto_uri, aad_app_id=client_id, app_key=client_secret, authority_id=tenant_id)
@@ -156,10 +152,10 @@ create_column_mapping_command = ".create table " + kusto_table_name + " ingestio
156152
kusto_client.execute_mgmt(database_name, create_column_mapping_command)
157153

158154

159-
print('Step 5: add data connection.')
155+
print('Step 5: add a event grid data connection. Azure Data Explorer will automatically ingest the data when new blobs are created.')
160156
kusto_management_client = KustoManagementClient(credentials, subscription_id)
161157
data_connections = kusto_management_client.data_connections
162-
#Returns an instance of LROPoller, check https://docs.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
158+
#Returns an instance of LROPoller, see https://docs.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
163159
poller = data_connections.create_or_update(resource_group_name=resource_group_name, cluster_name=kusto_cluster_name, database_name=kusto_database_name, data_connection_name=kusto_data_connection_name,
164160
parameters=EventGridDataConnection(storage_account_resource_id=storage_resource_id,
165161
event_hub_resource_id=event_hub_resource_id, consumer_group="$Default", location=location, table_name=kusto_table_name, mapping_rule_name=kusto_column_mapping_name, data_format="csv"))
@@ -201,7 +197,9 @@ print(response.primary_results[0].rows_count)
201197
To delete the resource group and clean up resources, use the following command:
202198

203199
```python
204-
resource_client.resource_groups.delete(resource_group_name=resource_group_name)
200+
#Returns an instance of LROPoller, see https://docs.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
201+
poller = resource_client.resource_groups.delete(resource_group_name=resource_group_name)
202+
poller.wait()
205203
```
206204

207205
## Next steps

0 commit comments

Comments
 (0)