Skip to content

Commit

Permalink
Update quickstart.bicep with new RP and simplify resource creation (1… (
Browse files Browse the repository at this point in the history
#104)

…1/12)

for ga

## Purpose
<!-- Describe the intention of the changes being proposed. What problem
does it solve or functionality does it add? -->
* ...

## Does this introduce a breaking change?
<!-- Mark one with an "x". -->
```
[ ] Yes
[ ] No
```

## Pull Request Type
What kind of change does this Pull Request introduce?

<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
```

## How to Test
*  Get the code

```
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
```

* Test the code
<!-- Add steps to run the tests suite and/or manually test -->
```
```

## What to Check
Verify that the following are valid
* ...

## Other Information
<!-- Add any other helpful information that may be needed here. -->
  • Loading branch information
meenag16 authored Nov 13, 2024
1 parent 582d1c8 commit 9cc6ce1
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions samples/quickstarts/quickstart.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ param resourceSuffix string = substring(uniqueString(subscription().id, resource
param eventHubName string = 'aio-eh-${resourceSuffix}'
param defaultDataflowEndpointName string = 'default'
param defaultDataflowProfileName string = 'default'
param createRoleAssignment bool = true

/*****************************************************************************/
/* Existing AIO cluster */
Expand All @@ -30,15 +31,15 @@ resource aioExtension 'Microsoft.KubernetesConfiguration/extensions@2022-11-01'
scope: connectedCluster
}

resource aioInstance 'Microsoft.IoTOperations/instances@2024-09-15-preview' existing = {
resource aioInstance 'Microsoft.IoTOperations/instances@2024-11-01' existing = {
name: aioInstanceName
}

resource defaultDataflowEndpoint 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-09-15-preview' existing = {
resource defaultDataflowEndpoint 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-11-01' existing = {
name: defaultDataflowEndpointName
}

resource defaultDataflowProfile 'Microsoft.IoTOperations/instances/dataflowProfiles@2024-09-15-preview' existing = {
resource defaultDataflowProfile 'Microsoft.IoTOperations/instances/dataflowProfiles@2024-11-01' existing = {
name: defaultDataflowProfileName
parent: aioInstance
}
Expand All @@ -49,7 +50,7 @@ resource defaultDataflowProfile 'Microsoft.IoTOperations/instances/dataflowProfi

var assetName = 'oven'

resource assetEndpoint 'Microsoft.DeviceRegistry/assetEndpointProfiles@2024-09-01-preview' = {
resource assetEndpoint 'Microsoft.DeviceRegistry/assetEndpointProfiles@2024-11-01' = {
name: 'opc-ua-connector-0'
location: resourceGroup().location
extendedLocation: {
Expand All @@ -65,7 +66,7 @@ resource assetEndpoint 'Microsoft.DeviceRegistry/assetEndpointProfiles@2024-09-0
}
}

resource asset 'Microsoft.DeviceRegistry/assets@2024-09-01-preview' = {
resource asset 'Microsoft.DeviceRegistry/assets@2024-11-01' = {
name: assetName
location: resourceGroup().location
extendedLocation: {
Expand Down Expand Up @@ -127,17 +128,16 @@ resource eventHubNamespace 'Microsoft.EventHub/namespaces@2024-01-01' = {
location: resourceGroup().location
properties: {
disableLocalAuth: false
minimumTlsVersion: '1.2'
}
}

// Role assignment for Event Hubs Data Sender role
resource roleAssignmentDataSender 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
resource roleAssignmentDataSender 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (createRoleAssignment) {
name: guid(eventHubNamespace.id, aioExtension.id, '69b88ce2-a752-421f-bd8b-e230189e1d63')
scope: eventHubNamespace
properties: {
// ID for Event Hubs Data Sender role is 2b629674-e913-4c01-ae53-ef4638d8f975
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '2b629674-e913-4c01-ae53-ef4638d8f975')
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '2b629674-e913-4c01-ae53-ef4638d8f975')
principalId: aioExtension.identity.principalId
principalType: 'ServicePrincipal'
}
Expand All @@ -156,7 +156,7 @@ resource eventHub 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = {
/* Dataflow */
/*****************************************************************************/

resource dataflowEndpointEventHub 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-09-15-preview' = {
resource dataflowEndpointEventHub 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-11-01' = {
parent: aioInstance
name: 'quickstart-eh-endpoint'
extendedLocation: {
Expand Down Expand Up @@ -187,8 +187,7 @@ resource dataflowEndpointEventHub 'Microsoft.IoTOperations/instances/dataflowEnd
]
}


resource dataflowCToF 'Microsoft.IoTOperations/instances/dataflowProfiles/dataflows@2024-09-15-preview' = {
resource dataflowCToF 'Microsoft.IoTOperations/instances/dataflowProfiles/dataflows@2024-11-01' = {
parent: defaultDataflowProfile
name: 'quickstart-oven-dataflow'
extendedLocation: {
Expand Down Expand Up @@ -239,9 +238,9 @@ resource dataflowCToF 'Microsoft.IoTOperations/instances/dataflowProfiles/datafl
{
type: 'Rename'
inputs: [
'FillWeight.Value'
'Temperature.Value'
]
output: 'FillWeight'
output: 'Temperature.Value'
}
{
inputs: [
Expand All @@ -266,4 +265,8 @@ resource dataflowCToF 'Microsoft.IoTOperations/instances/dataflowProfiles/datafl
]
}

output eventHubName string = eventHubNamespace.name
output eventHub object = {
name: eventHub.name
namespace: eventHubNamespace.name
}

0 comments on commit 9cc6ce1

Please sign in to comment.