In version 2.0 there are dynamic properties. You should remove the jsonencode.
https://registry.terraform.io/providers/Azure/azapi/latest/docs/guides/2.0-upgrade-guide
body = {
"location" : var.location,
"properties" : {
"keyVaultSecretName" : "abcdef"
}
}