Azure / Azure/azure-rest-api-specs

[Sample Issue] Regenrating Log Analytics Workspace Access Keys requires a parameter that isn't documented.

Open
#29,592 1 comment 1 reaction 0 assignees View on GitHub
customer-reported Mgmt Operational Insights question Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 37m
Merged PRs (30d)
446

Description

### Link to sample

https://learn.microsoft.com/en-us/rest/api/loganalytics/shared-keys/regenerate?view=rest-loganalytics-2023-09-01&tabs=Python#regeneratesharedkeys

### Library name and version

azure-mgmt-loganalytics 12.0.0

### Language of the Sample

- [ ] C#/.NET
- [ ] Java
- [ ] JavaScript/TypedScript
- [X] Python
- [ ] Golang
- [X] Other - Please specify in Issue details field

### Sample Issue Type

- [X] Sample not working
- [ ] Sample missing
- [ ] Do not understand sample

### Issue details

Hey there,

The REST API documented on the linked page is missing a required parameter. The sample in its current form results in the error `keyType value must equal primarySharedKey or secondarySharedKey`. Some experimentation shows that this key-value-pair should be passed as a query parameter.

The error in the API documentation also affects libraries generated from it, e.g. `azure-mgmt-loganalytics` version 12.0.0. The library has no way to pass this parameter, so we are forced to use direct HTTP calls with an undocumented parameter instead of using the appropriate function in the management library.

Thanks a bunch,
Kjeld

### Expected behavior

I should be able to pass a parameter to define which key to regenerate into `LogAnalyticsManagementClient.shared_keys.regenerate`.

This should then result in that one key being regenerated.

### Actual behavior

I cannot pass a key specifier into `LogAnalyticsManagementClient.shared_keys.regenerate`.

The call results in a failed request with the error `keyType value must equal primarySharedKey or secondarySharedKey`.

### Reproduction Steps

Follow [this sample request](https://learn.microsoft.com/en-us/rest/api/loganalytics/shared-keys/regenerate?view=rest-loganalytics-2023-09-01&tabs=Python#regeneratesharedkeys)

i.e., create a Log Analytics Workspace, get a `LogAnalyticsManagementClient` and attempt to call `client.shared_keys.regenerate` with the appropriate Workspace details as parameters.

### Environment

Library: azure-mgmt-loganalytics
Library version: 12.0.0
OS: Windows 10
Python Version: 3.11.8

Contributor guide

Open the contributing guide

Research direction

Start with the linked Log Analytics regenerate REST API sample and compare its request with the azure-mgmt-loganalytics 12.0.0 client method LogAnalyticsManagementClient.shared_keys.regenerate. Verify how the keyType query parameter is represented in the API specification and generated Python client; done means callers can select primarySharedKey or secondarySharedKey and the request succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.