Skip to content

Commit afdacfd

Browse files
committed
Asset endpoint Bicep file
1 parent 557f7ff commit afdacfd

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
metadata description = 'Asset endpoint profile for media connector'
2+
3+
@description('Specifies the name of the key vault you are using.')
4+
param keyVaultName string
5+
6+
@description('The RTSP endpoint for the media stream.')
7+
param targetAddress string
8+
9+
@description('The name of the custom location you are using.')
10+
param customLocationName string
11+
12+
@description('Specifies the name of the user-assigned managed identity you are using.')
13+
param uamiName string
14+
15+
@secure()
16+
@description('Specifies the base64 value of the username secret that you want to create.')
17+
param secretValueUsername string
18+
19+
@secure()
20+
@description('Specifies the base64 value of the password secret that you want to create.')
21+
param secretValuePassword string
22+
23+
@description('Specifies the name of the asset endpoint resource to create.')
24+
param aepName string = 'contoso-rtsp-aep-1'
25+
26+
@description('The name of the Kubernetes secret to create.')
27+
param secretName string = 'contoso-secret'
28+
29+
@description('Specifies the name of the SPC resource to create.')
30+
param spcName string = 'contoso-spc'
31+
32+
/*****************************************************************************/
33+
/* Existing AIO cluster */
34+
/*****************************************************************************/
35+
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
36+
name: customLocationName
37+
}
38+
39+
/*****************************************************************************/
40+
/* Add AKV secrets */
41+
/*****************************************************************************/
42+
resource kv 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
43+
name: keyVaultName
44+
}
45+
46+
resource username 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
47+
parent: kv
48+
name: 'username'
49+
properties: {
50+
value: secretValueUsername
51+
}
52+
}
53+
54+
resource password 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
55+
parent: kv
56+
name: 'password'
57+
properties: {
58+
value: secretValuePassword
59+
}
60+
}
61+
62+
/*****************************************************************************/
63+
/* Update SPC resource */
64+
/* - It's not possible to update an SPC resource using bicep, creating a new */
65+
/* SPC resource instead. */
66+
/*****************************************************************************/
67+
resource uami 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-07-31-preview' existing = {
68+
name: uamiName
69+
}
70+
71+
resource spc 'Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses@2024-08-21-preview' = {
72+
name: spcName
73+
extendedLocation: {
74+
type: 'CustomLocation'
75+
name: customLocation.id
76+
}
77+
location: resourceGroup().location
78+
properties: {
79+
clientId: uami.properties.clientId
80+
keyvaultName: keyVaultName
81+
objects: 'array:\n - |\n objectName: username\n objectType: secret\n - |\n objectName: password\n objectType: secret\n'
82+
tenantId: kv.properties.tenantId
83+
}
84+
}
85+
86+
/*****************************************************************************/
87+
/* Add secretSync */
88+
/*****************************************************************************/
89+
resource secretSync 'Microsoft.SecretSyncController/secretSyncs@2024-08-21-preview' = {
90+
name: secretName
91+
extendedLocation: {
92+
type: 'CustomLocation'
93+
name: customLocation.id
94+
}
95+
location: resourceGroup().location
96+
properties: {
97+
kubernetesSecretType: 'Opaque'
98+
objectSecretMapping: [
99+
{
100+
sourcePath: 'username'
101+
targetKey: 'username'
102+
}
103+
{
104+
sourcePath: 'password'
105+
targetKey: 'password'
106+
}
107+
]
108+
secretProviderClassName: spcName
109+
serviceAccountName: 'aio-ssc-sa'
110+
}
111+
}
112+
113+
/*****************************************************************************/
114+
/* Asset endpoint profile */
115+
/*****************************************************************************/
116+
resource assetEndpoint 'Microsoft.DeviceRegistry/assetEndpointProfiles@2024-11-01' = {
117+
name: aepName
118+
location: resourceGroup().location
119+
extendedLocation: {
120+
type: 'CustomLocation'
121+
name: customLocation.id
122+
}
123+
properties: {
124+
targetAddress: targetAddress
125+
endpointProfileType: 'Microsoft.Media'
126+
additionalConfiguration: '{"@schema":"https://aiobrokers.blob.core.windows.net/aio-media-connector/1.0.0.json"}'
127+
authentication: {
128+
method: 'UsernamePassword'
129+
usernamePasswordCredentials: {
130+
passwordSecretName: '${secretName}/password'
131+
usernameSecretName: '${secretName}/username'
132+
}
133+
}
134+
}
135+
}

0 commit comments

Comments
 (0)