Azure / Azure/apiops

[BUG] Removing Backend credentials not working

Aperta
#749 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
448
Fork
247
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Release version

APIOps latest

### Describe the bug

We want to remove the credentials from a backend configuration while puclishing.
So when overwritting the configuration, we set the array to empty for both certificate and certificateIds.

The configuration is set as follows:
```
backends:
- name: "my-backend"
properties:
url: "https://example.com"
credentials:
certificate: []
certificateIds: []
```

However, we still get the error of missing certificate when we try to publish this without the certificate.

### Expected behavior

Backend created without any credentials and errors

### Actual behavior

We are getting validation error.

```
crit: Publisher[0]
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/backends/my-backend?api-version=2022-04-01-preview failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"credentials","message":"Certificate with id 'my-cert' not found."}]}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
at publisher.Program.<>c__DisplayClass12_0.<b__0>d.MoveNext()

```

### Reproduction Steps

Create a backend with certificate credentials.

and try to publish a new one without certificate credentials.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando la richiesta PUT del backend in publisher.Program e il payload delle credenziali inviato all’endpoint backends di Azure API Management. Riproduci l’aggiornamento da certificato a credenziali vuote e verifica che la pubblicazione abbia esito positivo senza conservare il certificato precedente né restituire l’errore di convalida.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, csharp
Ambito
api, backend, cloud
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.