Skip to content

Commit 6ac3fab

Browse files
authored
Service connector keyvaut secret (#18258)
1 parent 8281222 commit 6ac3fab

File tree

4 files changed

+159
-19
lines changed

4 files changed

+159
-19
lines changed

specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLink.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
"properties": {
88
"targetService": {
99
"type": "AzureResource",
10-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
10+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
1111
},
1212
"authInfo": {
1313
"authType": "secret",
1414
"name": "name",
15-
"secret": "secret"
15+
"secret": {
16+
"secretType": "rawValue",
17+
"value": "secret"
18+
}
1619
}
1720
}
1821
}
@@ -29,7 +32,7 @@
2932
},
3033
"targetService": {
3134
"type": "AzureResource",
32-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
35+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
3336
}
3437
}
3538
}
@@ -45,7 +48,7 @@
4548
},
4649
"targetService": {
4750
"type": "AzureResource",
48-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
51+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
4952
}
5053
}
5154
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"parameters": {
3+
"api-version": "2022-01-01-preview",
4+
"resourceUri": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app",
5+
"linkerName": "linkName",
6+
"parameters": {
7+
"properties": {
8+
"targetService": {
9+
"type": "AzureResource",
10+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
11+
},
12+
"authInfo": {
13+
"authType": "secret"
14+
},
15+
"secretStore": {
16+
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
17+
}
18+
}
19+
}
20+
},
21+
"responses": {
22+
"200": {
23+
"body": {
24+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app/providers/Microsoft.ServiceLinker/links/linkName",
25+
"type": "Microsoft.ServiceLinker/links",
26+
"name": "linkName",
27+
"properties": {
28+
"authInfo": {
29+
"authType": "secret"
30+
},
31+
"secretStore": {
32+
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
33+
},
34+
"targetService": {
35+
"type": "AzureResource",
36+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
37+
}
38+
}
39+
}
40+
},
41+
"201": {
42+
"body": {
43+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app/providers/Microsoft.ServiceLinker/links/linkName",
44+
"type": "Microsoft.ServiceLinker/links",
45+
"name": "linkName",
46+
"properties": {
47+
"authInfo": {
48+
"authType": "secret"
49+
},
50+
"secretStore": {
51+
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
52+
},
53+
"targetService": {
54+
"type": "AzureResource",
55+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}

specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/examples/PutLinkWithServiceEndpoint.json

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
"properties": {
88
"targetService": {
99
"type": "AzureResource",
10-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
10+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
1111
},
1212
"authInfo": {
1313
"authType": "secret",
1414
"name": "name",
15-
"secret": "secret"
15+
"secret": {
16+
"secretType": "keyVaultSecretUri",
17+
"value": "https://vault-name.vault.azure.net/secrets/secret-name/00000000000000000000000000000000"
18+
}
1619
},
1720
"vNetSolution": {
1821
"type": "serviceEndpoint"
19-
},
20-
"secretStore": {
21-
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
2222
}
2323
}
2424
}
@@ -37,12 +37,9 @@
3737
"vNetSolution": {
3838
"type": "serviceEndpoint"
3939
},
40-
"secretStore": {
41-
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
42-
},
4340
"targetService": {
4441
"type": "AzureResource",
45-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
42+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
4643
}
4744
}
4845
}
@@ -60,12 +57,9 @@
6057
"vNetSolution": {
6158
"type": "serviceEndpoint"
6259
},
63-
"secretStore": {
64-
"keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"
65-
},
6660
"targetService": {
6761
"type": "AzureResource",
68-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"
62+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"
6963
}
7064
}
7165
}

specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-01-01-preview/servicelinker.json

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
},
120120
"PutLinkWithServiceEndpoint": {
121121
"$ref": "./examples/PutLinkWithServiceEndpoint.json"
122+
},
123+
"PutLinkWithSecretStore": {
124+
"$ref": "./examples/PutLinkWithSecretStore.json"
122125
}
123126
},
124127
"parameters": [
@@ -521,6 +524,86 @@
521524
"modelAsString": true
522525
}
523526
},
527+
"SecretType": {
528+
"description": "The secret type.",
529+
"type": "string",
530+
"enum": [
531+
"rawValue",
532+
"keyVaultSecretUri",
533+
"keyVaultSecretReference"
534+
],
535+
"x-ms-enum": {
536+
"name": "SecretType",
537+
"modelAsString": true
538+
}
539+
},
540+
"SecretInfoBase": {
541+
"description": "The secret info",
542+
"discriminator": "secretType",
543+
"type": "object",
544+
"properties": {
545+
"secretType": {
546+
"description": "The secret type.",
547+
"$ref": "#/definitions/SecretType"
548+
}
549+
},
550+
"required": [
551+
"secretType"
552+
]
553+
},
554+
"ValueSecretInfo": {
555+
"x-ms-discriminator-value": "rawValue",
556+
"type": "object",
557+
"description": "The secret info when type is rawValue. It's for scenarios that user input the secret.",
558+
"allOf": [
559+
{
560+
"$ref": "#/definitions/SecretInfoBase"
561+
}
562+
],
563+
"properties": {
564+
"value": {
565+
"description": "The actual value of the secret.",
566+
"type": "string",
567+
"x-ms-secret": true
568+
}
569+
}
570+
},
571+
"KeyVaultSecretReferenceSecretInfo": {
572+
"x-ms-discriminator-value": "keyVaultSecretReference",
573+
"type": "object",
574+
"description": "The secret info when type is keyVaultSecretReference. It's for scenario that user provides a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId.",
575+
"allOf": [
576+
{
577+
"$ref": "#/definitions/SecretInfoBase"
578+
}
579+
],
580+
"properties": {
581+
"name": {
582+
"description": "Name of the Key Vault secret.",
583+
"type": "string"
584+
},
585+
"version": {
586+
"description": "Version of the Key Vault secret.",
587+
"type": "string"
588+
}
589+
}
590+
},
591+
"KeyVaultSecretUriSecretInfo": {
592+
"x-ms-discriminator-value": "keyVaultSecretUri",
593+
"type": "object",
594+
"description": "The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App.",
595+
"allOf": [
596+
{
597+
"$ref": "#/definitions/SecretInfoBase"
598+
}
599+
],
600+
"properties": {
601+
"value": {
602+
"description": "URI to the keyvault secret",
603+
"type": "string"
604+
}
605+
}
606+
},
524607
"AuthInfoBase": {
525608
"description": "The authentication info",
526609
"discriminator": "authType",
@@ -551,8 +634,7 @@
551634
},
552635
"secret": {
553636
"description": "Password or account key for secret auth.",
554-
"type": "string",
555-
"x-ms-secret": true
637+
"$ref": "#/definitions/SecretInfoBase"
556638
}
557639
}
558640
},

0 commit comments

Comments
 (0)