瀏覽代碼

Add Bicep sample

Anthony Martin 4 年之前
父節點
當前提交
91136c816f
共有 3 個文件被更改,包括 62 次插入0 次删除
  1. 4 0
      test/samples-all.generated.js
  2. 29 0
      test/samples/sample.bicep.txt
  3. 29 0
      website/index/samples/sample.bicep.txt

文件差異過大導致無法顯示
+ 4 - 0
test/samples-all.generated.js


+ 29 - 0
test/samples/sample.bicep.txt

@@ -0,0 +1,29 @@
+targetScope = 'subscription'
+
+param deployStorage bool = true
+
+@description('The object ID of the principal that will get the role assignment')
+param aadPrincipalId string
+
+module stg './storage.bicep' = if(deployStorage) {
+  name: 'storageDeploy'
+  scope: resourceGroup('another-rg') // this will target another resource group in the same subscription
+  params: {
+    storageAccountName: '<YOURUNIQUESTORAGENAME>'
+  }
+}
+
+var contributor = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
+resource roleDef 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
+  name: contributor
+}
+
+resource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
+  name: guid(subscription().id, aadPrincipalId, contributor)
+  properties: {
+    roleDefinitionId: roleDef.id
+    principalId: aadPrincipalId
+  }
+}
+
+output storageName array = stg.outputs.containerProps

+ 29 - 0
website/index/samples/sample.bicep.txt

@@ -0,0 +1,29 @@
+targetScope = 'subscription'
+
+param deployStorage bool = true
+
+@description('The object ID of the principal that will get the role assignment')
+param aadPrincipalId string
+
+module stg './storage.bicep' = if(deployStorage) {
+  name: 'storageDeploy'
+  scope: resourceGroup('another-rg') // this will target another resource group in the same subscription
+  params: {
+    storageAccountName: '<YOURUNIQUESTORAGENAME>'
+  }
+}
+
+var contributor = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
+resource roleDef 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
+  name: contributor
+}
+
+resource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
+  name: guid(subscription().id, aadPrincipalId, contributor)
+  properties: {
+    roleDefinitionId: roleDef.id
+    principalId: aadPrincipalId
+  }
+}
+
+output storageName array = stg.outputs.containerProps

部分文件因文件數量過多而無法顯示