Skip to content

[MetricsAdvisor] Merged MetricsAdvisorKeyCredential UpdateKey methods into single one#21947

Merged
kinelski merged 4 commits intoAzure:mainfrom
kinelski:ma-credential
Jun 22, 2021
Merged

[MetricsAdvisor] Merged MetricsAdvisorKeyCredential UpdateKey methods into single one#21947
kinelski merged 4 commits intoAzure:mainfrom
kinelski:ma-credential

Conversation

@kinelski
Copy link
Contributor

Merging UpdateSubscriptionKey and UpdateApiKey into a single Update method to support atomic update. We already had something close to this in Core (AzureNamedKeyCredential), so we're following a similar implementation.

@kinelski kinelski added Client This issue is related to a non-management package Cognitive - Metrics Advisor labels Jun 17, 2021
@kinelski kinelski requested a review from maririos June 17, 2021 23:07
@kinelski kinelski self-assigned this Jun 17, 2021
Copy link
Member

@maririos maririos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine you already have a test for this updating the credentials, so approving. In case that is not true, can you please include a test?

@kinelski
Copy link
Contributor Author

I imagine you already have a test for this updating the credentials, so approving. In case that is not true, can you please include a test?

Added three tests:

  • Assert we're sending credential headers in MA client operations.
  • Assert we're sending credential headers in MA admin client operations.
  • Assert we're updating credential headers correctly.

@check-enforcer
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them. In order to bootstrap pipelines for a new service, please perform following steps:

For data-plane/track 2 SDKs Issue the following command as a pull request comment:

/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run net - [service] - ci

For track 1 management-plane SDKs

Please open a separate PR and to your service SDK path in this file. Once that PR has been merged, you can re-run the pipeline to trigger the verification.

string expectedSubscriptionKey = "newFakeSubscriptionKey";
string expectedApiKey = "newFakeApiKey";

credential.Update(expectedSubscriptionKey, expectedApiKey);
Copy link
Member

@maririos maririos Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of mocking, I believe that you are attached to the client you created. A user will use the update method in an already live client instead of creating one with the updated credentials.
Do you think it is worth adding a live test that reflects that behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move the Update call to the point after creating the client.

@kinelski kinelski merged commit d0f4b8b into Azure:main Jun 22, 2021
@kinelski kinelski deleted the ma-credential branch June 22, 2021 08:15
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-net that referenced this pull request Jan 3, 2023
{AzureFrontdoor} fixes Azure/azure-cli#24758 fixing ActionType enum to include AnomalyScoring (Azure#21947)

fixes Azure/azure-cli#24758 fixing ActionType enum to include AnomalyScoring

Running the below command to override the managed rules with --action set to AnomalyScoring fails:
> az network front-door waf-policy managed-rules override add

```
az network front-door waf-policy managed-rules override add: 'AnomalyScoring' is not a valid value for '--action'. Allowed values: Allow, Block, Log, Redirect.

```

This is because currently only the `Allow, Block, Log, Redirect` enums are specified. `AnomalyScoring` value should also be included in the `ActionType`  enums.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client This issue is related to a non-management package Cognitive - Metrics Advisor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants