@@ -34,6 +34,7 @@ internal sealed class RuleDataExportVisitor : TemplateVisitor
34
34
private const string PROPERTY_LOGINSERVER = "loginServer" ;
35
35
private const string PROPERTY_RULES = "rules" ;
36
36
private const string PROPERTY_RULEID = "ruleId" ;
37
+ private const string PROPERTY_ACCESSPOLICIES = "accessPolicies" ;
37
38
38
39
private const string PLACEHOLDER_GUID = "ffffffff-ffff-ffff-ffff-ffffffffffff" ;
39
40
private const string IDENTITY_SYSTEMASSIGNED = "SystemAssigned" ;
@@ -50,6 +51,7 @@ internal sealed class RuleDataExportVisitor : TemplateVisitor
50
51
private const string TYPE_NETWORKINTERFACE = "Microsoft.Network/networkInterfaces" ;
51
52
private const string TYPE_SUBSCRIPTIONALIAS = "Microsoft.Subscription/aliases" ;
52
53
private const string TYPE_CONTAINERREGISTRY = "Microsoft.ContainerRegistry/registries" ;
54
+ private const string TYPE_KEYVAULT = "Microsoft.KeyVault/vaults" ;
53
55
private const string TYPE_STORAGE_OBJECTREPLICATIONPOLICIES = "Microsoft.Storage/storageAccounts/objectReplicationPolicies" ;
54
56
55
57
private static readonly JsonMergeSettings _MergeSettings = new ( )
@@ -128,7 +130,8 @@ private static void ProjectRuntimeProperties(TemplateContext context, IResourceV
128
130
ProjectContainerRegistry ( context , resource ) ||
129
131
ProjectPrivateEndpoints ( context , resource ) ||
130
132
ProjectSubscriptionAlias ( context , resource ) ||
131
- StorageObjectReplicationPolicies ( context , resource ) ||
133
+ ProjectStorageObjectReplicationPolicies ( context , resource ) ||
134
+ ProjectKeyVault ( context , resource ) ||
132
135
ProjectResource ( context , resource ) ;
133
136
}
134
137
@@ -246,10 +249,31 @@ private static bool ProjectContainerRegistry(TemplateContext context, IResourceV
246
249
{
247
250
properties [ PROPERTY_LOGINSERVER ] = $ "{ resource . Name } .azurecr.io";
248
251
}
252
+ return ProjectResource ( context , resource ) ;
253
+ }
254
+
255
+ private static bool ProjectKeyVault ( TemplateContext context , IResourceValue resource )
256
+ {
257
+ if ( ! resource . IsType ( TYPE_KEYVAULT ) )
258
+ return false ;
259
+
260
+ resource . Value . UseProperty ( PROPERTY_PROPERTIES , out JObject properties ) ;
261
+
262
+ // Add properties.accessPolicies
263
+ if ( ! properties . ContainsKeyInsensitive ( PROPERTY_ACCESSPOLICIES ) )
264
+ {
265
+ properties [ PROPERTY_ACCESSPOLICIES ] = new JArray ( ) ;
266
+ }
267
+
268
+ // Add properties.tenantId
269
+ if ( ! properties . ContainsKeyInsensitive ( PROPERTY_TENANTID ) )
270
+ {
271
+ properties [ PROPERTY_TENANTID ] = context . Tenant . TenantId ;
272
+ }
249
273
return true ;
250
274
}
251
275
252
- private static bool StorageObjectReplicationPolicies ( TemplateContext context , IResourceValue resource )
276
+ private static bool ProjectStorageObjectReplicationPolicies ( TemplateContext context , IResourceValue resource )
253
277
{
254
278
if ( ! resource . IsType ( TYPE_STORAGE_OBJECTREPLICATIONPOLICIES ) )
255
279
return false ;
0 commit comments