How to do APIM clean Cache in azure - azure

Is there any way to clean the cache in azure apim ?
For example if there is a bad value in cache , i want to clean that cache . How can i delete or remove that ?
I want ways how to do that , via apim policy or anything else .

Related

Error while permanent deleting soft deleted blob through rest API

Please help with error PermanentDeleteNotSupportedOnRootBlob
I generated SAStoken for BLOB with all permissions including Delete & Permanent Delete
While making API call using below blog
https://learn.microsoft.com/en-us/rest/api/storageservices/delete-blob
request url:
"https://[SAS URL]&deletetype=permanent"
Getting 409 error as "PermanentDeleteNotSupportedOnRootBlob"
x-ms-delete-snapshots in the header is "include"
Storage Account - 'Permanent Delete soft deleted blobs' option is enabled
Google does not return anything for PermanentDeleteNotSupportedOnRootBlob
Also tried with both Signing method as Account key & User delegation key and got same error
I tried to reproduce the same in my environment.
To permanently delete blob , their snapshot must also be soft deleted
For that Make sure to enable versioning for blobs while creating.
If already created, you can enable version from data protection configuration.
With
https://xxxx.blob.core.windows.net/container/blob?sp=r&st=2023-01-27T12:43:35Z&se=2023-01-27T20:43:35Z&spr=https&sv=2021-06-08&sr=b&sig=xxxx%3D&deletetype=permanent
The blob can be deleted successfully
Note:
Make sure the versionId is given correctly.
For already existing blob, disable soft delete , undelete the blobs then enable all the above mentioned properties and delete again.
Otherwise one may come across 409 error.
Reference: Delete Blob (REST API) -permanent-delete Azure Storage | Microsoft Learn

GKE: Impossible to delete a cluster

I have a weird issue with GKE, the cluster has been created by Terraform, and I tried to make a change requiring a deletion and re-creation.
It failed at the re-creation because I was missing an API, so I added it and retry.
Thing is that I have a cluster that exists, empty but with failed to delete cluster message on it.
I never had this issue and I already destroyed and re-created this very resource. I tried to destroy all the resources created by terraform on this project but I still get an error "failed to delete cluster".
Also I tried to do it by hand on the UI but still get the same error.
I tried to do it using
gcloud container clusters delete <cluster_name> and got
"Failed to delete cluster, name: operation-xxx-xxx..." and got a link to the operation failed.
It's a JSON with a 401 code, with the following message:
Request is missing required authentication credential. Expected OAuth
2 access token, login cookie or other valid authentication credential.
See
https://developers.google.com/identity/sign-in/web/devconsole-project.
I tried to re-auth but it doesn't help I get the same error.
I'm running out of idea, can you help me here?
A 401 (unauthorized) suggests that you've insufficient permissions to delete the cluster.
Either get a role that permits your user account to delete clusters.
Or ask someone who has an account that has sufficient powers to delete it for you.
Or authenticate gcloud (gcloud activate-service-account) with the Service Account that you used to create the cluster (assuming it can delete clusters too) and then use gcloud container clusters delete ... optionally include --account=${SERVICE_ACCOUNT_EMAIL} or just ensure the Service Account is ACTIVE with gcloud auth list.
I did not found a proper solution, but what did work was to delete the whole project and start over.
Luckily for me it was a lab, not a production project...

How to retreive memory cache in Azure app service

I am hosting a Net core application as as Azure app service. The app uses Microsoft.Extensions.Caching.Memoryto set and get string values to cache. Is there a way I can see the key-values stored in my server's in-memory cache ?
Reason:- The values I set, always seem to be null when I retrieve them.
Is there anything like Redis console in azure portal to check the key values present in memory cache?
the part of code used to set and get.
_memoryCache.Set("key1", "value1", TimeSpan.FromHours(1))
_memoryCache.TryGetValue("key1", out string result)
There is no function you mentioned on the azure portal.
Follow below steps, you can retrieve the value.
You need add services.AddMemoryCache(); in ConfigureServices.
And you also change your controller like below. Then you will get the value. It will not be null.

Azure Api management purge

I guys, I am running some test with terraform and terratest, I created a API Management and deleted it, but I didn't realised that APIM has soft delete enabled by default, and now I can't create another one with the same name as I am supposed to purge the deleted one.
I tried to look in azure portal if there an option to purge the deleted APIM (same way as in key vaults) but I cannot find anything. And googling I couldn't find any solution related to purging the deleted APIM. Any help on how I can purge the deleted APIM please?
To delete a purged APIM instance use the following command:
az rest --method delete --header "Accept=application/json" \
-u 'https://management.azure.com/subscriptions/{SubscriptionId}/providers/Microsoft.ApiManagement/locations/{eastus}/deletedservices/{api name}?api-version=2020-06-01-preview'

Failed to update autoscale configuration

I'm struggling with this for days and I can't find any resources/solutions for my problem. I want to autoscale my website api to request count and I always get this error "Failed to update autoscale configuration" when I try to save it. Mind you, I have 1 resource group and in this group they are 3 web apps and 1 sql server in it. I can see that I can scale only on App service plan. Why is that? Where can I find more descriptive error?
There might have some unexpected data in the original auto scale setting. I suggest you delete the original setting before adding a new one.
To only way I found currently to delete an autoscale setting is using Azure Monitor REST API. Here is the URL format and the method to send this request should be Delete.
https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/autoscaleSettings/{autoscale-setting-name}?api-version={api-version}
You could get the subscription id and resource group name from Azure portal. You could the autoscale setting name from the scale out panel of your Web App. The api version could be 2015-04-01.
In the request header, you also need to provide the Authorization Bearer token.
Authorization: Bearer eyJ0eXAiOiJK.....V1QiLCJhbGciOiJSUzI1NiIsIng1dCI6
An easy way to get Bearer token is that open IE/Edge debug tool by clicking F12. When you use any Azure feature from Azure portal, you could find the token in the Network -> Header panel.

Resources