|
1 | 1 | --- |
2 | 2 | title: |
3 | | -keywords: Azure, python, SDK, API, azure-mgmt-loganalytics, loganalytics |
4 | | -ms.date: 11/17/2021 |
| 3 | +keywords: Azure, python, SDK, API, azure-mgmt-loganalytics, azure-monitor |
| 4 | +ms.date: 12/09/2025 |
5 | 5 | ms.topic: reference |
6 | 6 | ms.devlang: python |
7 | | -ms.service: log-analytics |
| 7 | +ms.service: azure-monitor |
8 | 8 | --- |
9 | 9 | # Microsoft Azure SDK for Python |
10 | 10 |
|
11 | 11 | This is the Microsoft Azure Log Analytics Management Client Library. |
12 | | -This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. |
| 12 | +This package has been tested with Python 3.8+. |
13 | 13 | For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). |
14 | 14 |
|
| 15 | +## _Disclaimer_ |
15 | 16 |
|
16 | | -# Usage |
| 17 | +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ |
17 | 18 |
|
| 19 | +## Getting started |
18 | 20 |
|
19 | | -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) |
| 21 | +### Prerequisites |
20 | 22 |
|
| 23 | +- Python 3.8+ is required to use this package. |
| 24 | +- [Azure subscription](https://azure.microsoft.com/free/) |
21 | 25 |
|
| 26 | +### Install the package |
22 | 27 |
|
23 | | -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) |
24 | | -Code samples for this package can be found at [Log Analytics Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. |
25 | | -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) |
| 28 | +```bash |
| 29 | +pip install azure-mgmt-loganalytics |
| 30 | +pip install azure-identity |
| 31 | +``` |
26 | 32 |
|
| 33 | +### Authentication |
27 | 34 |
|
28 | | -# Provide Feedback |
| 35 | +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. |
29 | 36 |
|
30 | | -If you encounter any bugs or have suggestions, please file an issue in the |
31 | | -[Issues](https://github.com/Azure/azure-sdk-for-python/issues) |
32 | | -section of the project. |
| 37 | +- `AZURE_CLIENT_ID` for Azure client ID. |
| 38 | +- `AZURE_TENANT_ID` for Azure tenant ID. |
| 39 | +- `AZURE_CLIENT_SECRET` for Azure client secret. |
| 40 | + |
| 41 | +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. |
| 42 | + |
| 43 | +With above configuration, client can be authenticated by following code: |
| 44 | + |
| 45 | +```python |
| 46 | +from azure.identity import DefaultAzureCredential |
| 47 | +from azure.mgmt.loganalytics import LogAnalyticsManagementClient |
| 48 | +import os |
| 49 | + |
| 50 | +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") |
| 51 | +client = LogAnalyticsManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) |
| 52 | +``` |
33 | 53 |
|
| 54 | +## Examples |
34 | 55 |
|
| 56 | +Code samples for this package can be found at: |
| 57 | +- [Search Log Analytics Management](/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com |
| 58 | +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) |
35 | 59 |
|
36 | 60 |
|
| 61 | +## Troubleshooting |
| 62 | + |
| 63 | +## Next steps |
| 64 | + |
| 65 | +## Provide Feedback |
| 66 | + |
| 67 | +If you encounter any bugs or have suggestions, please file an issue in the |
| 68 | +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) |
| 69 | +section of the project. |
| 70 | + |
0 commit comments