Replace function in Azure Resource Graph Explorer

Giorgos Georgiadis 21 Reputation points
2022-08-24T05:47:27.873+00:00

Hi

I need some help on a query I am building

Resources
| where type == "microsoft.storage/storageaccounts"
| extend keysource = tostring(properties.encryption.keySource)
| extend keysource1 = replace(keysource, 'Microsoft.Keyvault' , 'EncryptionAtRestWithCustomerKey')
| project keysource1

The query fails with an unexpected error

Details:
An unexpected query execution error occurred. Please try again later. (Code:UnexpectedQueryExecutionError)

The documentation for Azure Resource Graph Explorer does not mention the replace function as supported, but in the query builder it seems that it is supported.

This is what I get if I just write the word replace


The function 'replace' requires an argument list.
(function) replace(regex, rewrite, text): string

The function 'replace' requires an argument list.


So it seems to be supported but I cannot understand why it fails.

My goal is to get the properties.encryption.keySource output and if the says Microsoft.Keyvault to replace it with the EncryptionAtRestWithCustomerKey string.

Any ideas before I go to MS support?

Thanks in advance

GG

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,778 questions
{count} votes

0 additional answers

Sort by: Most helpful