Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,13 @@ def cf_log_analytics_data_sources(cli_ctx, subscription_id, *_):

def cf_log_analytics_data_plane(cli_ctx, _):
"""Initialize Log Analytics data client for use with CLI."""
from azure.loganalytics import LogAnalyticsDataClient
from azure.monitor.query import LogsQueryClient
from azure.cli.core._profile import Profile
profile = Profile(cli_ctx=cli_ctx)
cred, _, _ = profile.get_login_credentials(
resource=cli_ctx.cloud.endpoints.log_analytics_resource_id)
api_version = 'v1'
return LogAnalyticsDataClient(cred,
base_url=cli_ctx.cloud.endpoints.log_analytics_resource_id + '/' + api_version)
return LogsQueryClient(cred, endpoint=cli_ctx.cloud.endpoints.log_analytics_resource_id + '/' + api_version)


def cf_disk_encryption_set(cli_ctx, _):
Expand Down
6 changes: 1 addition & 5 deletions src/azure-cli/azure/cli/command_modules/vm/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,10 @@ def transform_log_analytics_query_output(result):
tables_output = []

def _transform_query_output(table):
columns = table.columns
name = table.name
rows = table.rows

column_names = []
column_names = table.columns
table_output = []
for column in columns:
column_names.append(column.name)
for row in rows:
item = OrderedDict()
item['TableName'] = name
Expand Down
3 changes: 1 addition & 2 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -5083,7 +5083,6 @@ def _set_data_source_for_workspace(cmd, os_type, resource_group_name, workspace_

def execute_query_for_vm(cmd, client, resource_group_name, vm_name, analytics_query, timespan=None):
"""Executes a query against the Log Analytics workspace linked with a vm."""
from azure.loganalytics.models import QueryBody
vm = get_vm(cmd, resource_group_name, vm_name)
workspace = None
extension_resources = vm.resources or []
Expand All @@ -5093,7 +5092,7 @@ def execute_query_for_vm(cmd, client, resource_group_name, vm_name, analytics_qu
if workspace is None:
raise CLIError('Cannot find the corresponding log analytics workspace. '
'Please check the status of log analytics workpsace.')
return client.query(workspace, QueryBody(query=analytics_query, timespan=timespan))
return client.query_workspace(workspace, analytics_query, timespan=timespan)


def _set_log_analytics_workspace_extension(cmd, resource_group_name, vm, vm_name, workspace_name):
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ azure-keyvault-administration==4.4.0b2
azure-keyvault-certificates==4.7.0
azure-keyvault-keys==4.9.0b3
azure-keyvault-secrets==4.7.0
azure-loganalytics==0.1.0
azure-mgmt-advisor==9.0.0
azure-mgmt-apimanagement==4.0.0
azure-mgmt-appconfiguration==3.0.0
Expand Down Expand Up @@ -81,6 +80,7 @@ azure-mgmt-storage==21.1.0
azure-mgmt-synapse==2.1.0b5
azure-mgmt-trafficmanager==1.0.0
azure-mgmt-web==7.2.0
azure-monitor-query==1.2.0
azure-multiapi-storage==1.2.0
azure-nspkg==3.0.2
azure-storage-common==1.4.2
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.Linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ azure-keyvault-administration==4.4.0b2
azure-keyvault-certificates==4.7.0
azure-keyvault-keys==4.9.0b3
azure-keyvault-secrets==4.7.0
azure-loganalytics==0.1.0
azure-mgmt-advisor==9.0.0
azure-mgmt-apimanagement==4.0.0
azure-mgmt-appconfiguration==3.0.0
Expand Down Expand Up @@ -81,6 +80,7 @@ azure-mgmt-storage==21.1.0
azure-mgmt-synapse==2.1.0b5
azure-mgmt-trafficmanager==1.0.0
azure-mgmt-web==7.2.0
azure-monitor-query==1.2.0
azure-multiapi-storage==1.2.0
azure-nspkg==3.0.2
azure-storage-common==1.4.2
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/requirements.py3.windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ azure-keyvault-administration==4.4.0b2
azure-keyvault-certificates==4.7.0
azure-keyvault-keys==4.9.0b3
azure-keyvault-secrets==4.7.0
azure-loganalytics==0.1.0
azure-mgmt-advisor==9.0.0
azure-mgmt-apimanagement==4.0.0
azure-mgmt-appconfiguration==3.0.0
Expand Down Expand Up @@ -81,6 +80,7 @@ azure-mgmt-storage==21.1.0
azure-mgmt-synapse==2.1.0b5
azure-mgmt-trafficmanager==1.0.0
azure-mgmt-web==7.2.0
azure-monitor-query==1.2.0
azure-multiapi-storage==1.2.0
azure-nspkg==3.0.2
azure-storage-common==1.4.2
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
'azure-keyvault-certificates==4.7.0',
'azure-keyvault-keys==4.9.0b3',
'azure-keyvault-secrets==4.7.0',
'azure-loganalytics~=0.1.0',
'azure-mgmt-advisor==9.0.0',
'azure-mgmt-apimanagement==4.0.0',
'azure-mgmt-appconfiguration==3.0.0',
Expand Down Expand Up @@ -125,6 +124,7 @@
'azure-mgmt-synapse==2.1.0b5',
'azure-mgmt-trafficmanager~=1.0.0',
'azure-mgmt-web==7.2.0',
'azure-monitor-query==1.2.0',
'azure-multiapi-storage~=1.2.0',
'azure-storage-common~=1.4',
'azure-synapse-accesscontrol~=0.5.0',
Expand Down