Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bicep Module for Bing Resource #407

Merged
merged 23 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2fb78f0
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 9, 2023
3713e48
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 9, 2023
0f7b048
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 12, 2023
5d81cd9
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 12, 2023
741a462
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 12, 2023
cdaf611
fix: Bicep Module for Bing Resource
tanujbhatia1708 Jun 12, 2023
0aa6dba
updated files
tanujbhatia1708 Jun 12, 2023
30b8ef2
Autogenerate Bicep Files
tanujbhatia1708 Jun 12, 2023
7c3f99f
updated Readme.md
tanujbhatia1708 Jun 21, 2023
4bb9524
updated Readme.md
tanujbhatia1708 Jun 21, 2023
f4a700f
updated Readme.md
tanujbhatia1708 Jun 21, 2023
0f69591
Autogenerate Bicep Files
tanujbhatia1708 Jun 21, 2023
4767718
Merge branch 'main' into fix/XMIXSRE-2718-bing-resource
tanujbhatia1708 Jul 4, 2023
f5f590f
updated the path for bing service
tanujbhatia1708 Jul 4, 2023
3b74631
updated the path for bing service
tanujbhatia1708 Jul 4, 2023
38bfb48
updated the path for bing service
tanujbhatia1708 Jul 4, 2023
14998f1
updated the path for bing service
tanujbhatia1708 Jul 4, 2023
00ad70d
updated the path for bing service
tanujbhatia1708 Jul 4, 2023
2be654e
fix: Params to conform to contributing guidelines and tests
OmegaVVeapon Jul 4, 2023
36ad192
Autogenerate Bicep Files
OmegaVVeapon Jul 4, 2023
2d681e7
fix: update skuname for bing-search
tanujbhatia1708 Jul 4, 2023
8e452b4
Autogenerate Bicep Files
tanujbhatia1708 Jul 4, 2023
406f904
Apply suggestions from code review
dciborow Jul 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions modules/ai/bing-resource/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Bing Resource

This module deploys Azure Bing Resource

## Description

Azure Bing resource refers to the integration of Bing's search capabilities into the Azure platform. Azure provides the Azure Cognitive Search service, which allows you to incorporate powerful search functionality, including web search, image search, news search, video search, and more, using Bing's search algorithms.
This Bicep Module helps to create Bing Search Kind resource. You may need to register Microsoft/Bing resource provider for your subscription before using this module.

## Parameters

| Name | Type | Required | Description |
| :------------------ | :------: | :------: | :---------------------------------------------------------------------------------------------------------- |
| `prefix` | `string` | No | Prefix of Resource Name. Not used if name is provided |
| `location` | `string` | No | The location into which your Azure resources should be deployed. |
| `name` | `string` | No | The name of the Bing Service. |
| `kind` | `string` | No | Optional. This parameter will define Bing search kind. |
| `skuName` | `string` | No | Optional. The name of the SKU, F* (free) and S* (standard). Supported SKUs will differ based on search kind |
| `statisticsEnabled` | `bool` | No | Optional. Enable or disable Bing statistics. |
| `tags` | `object` | No | Optional. Tags of the resource. |

## Outputs

| Name | Type | Description |
| :--------- | :------: | :-------------- |
| `id` | `string` | Bing account ID |
| `endpoint` | `string` | Bing Endpoint |

## Examples

### Example 1

Deploy a Bing Search v7 resource with the free SKU

```
module bing-search-resource 'br/public:ai/bing-resource:1.0.1' = {
name: 'bing-search-resource'
params: {
kind: 'Bing.Search.v7'
location: 'global'
name: 'bing-search-resource-name-01'
skuName: 'S1'
}
}
```

### Example 2

Deploy a Bing Custom Search resource with the standard SKU

```
module bing-search-resource 'br/public:ai/bing-resource:1.0.1' = {
name: 'bing-search-resource'
params: {
kind: 'Bing.CustomSearch'
location: 'global'
name: 'bing-search-resource-name-02'
skuName: 'S1'
}
}
```
65 changes: 65 additions & 0 deletions modules/ai/bing-resource/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@description('Prefix of Resource Name. Not used if name is provided')
param prefix string = 'bng'

@description('The location into which your Azure resources should be deployed.')
param location string = resourceGroup().location

@minLength(2)
@maxLength(64)
// Must contain only lowercase letters, hyphens and numbers
// Must contain at least 2 through 64 characters
// Can't start or end with hyphen
@description('The name of the Bing Service.')
param name string = take('${prefix}-${kind}-${uniqueString(resourceGroup().id, location)}', 64)

@description('Optional. This parameter will define Bing search kind.')
@allowed(
[
'Bing.Search.v7'
'Bing.CustomSearch'
]
)
param kind string = 'Bing.Search.v7'

@description('Optional. The name of the SKU, F* (free) and S* (standard). Supported SKUs will differ based on search kind')
@allowed(
[
'F0'
'F1'
'S1'
'S2'
'S3'
'S4'
'S5'
'S6'
'S7'
'S8'
'S9'
]
)
param skuName string = 'F1'

@description('Optional. Enable or disable Bing statistics.')
param statisticsEnabled bool = false

@description('Optional. Tags of the resource.')
param tags object = {}

resource BingAccount 'Microsoft.Bing/accounts@2020-06-10' = {
name: name
location: location
tags: tags

kind: kind
properties: {
statisticsEnabled: statisticsEnabled
}
sku: {
name: skuName
}
}

@description('Bing account ID')
output id string = BingAccount.id
@description('Bing Endpoint')
output endpoint string = BingAccount.properties.endpoint
113 changes: 113 additions & 0 deletions modules/ai/bing-resource/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.18.4.5664",
"templateHash": "5128592152439671358"
}
},
"parameters": {
"prefix": {
"type": "string",
"defaultValue": "bng",
"metadata": {
"description": "Prefix of Resource Name. Not used if name is provided"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location into which your Azure resources should be deployed."
}
},
"name": {
"type": "string",
"defaultValue": "[take(format('{0}-{1}-{2}', parameters('prefix'), parameters('kind'), uniqueString(resourceGroup().id, parameters('location'))), 64)]",
"metadata": {
"description": "The name of the Bing Service."
},
"maxLength": 64,
"minLength": 2
},
"kind": {
"type": "string",
"defaultValue": "Bing.Search.v7",
"allowedValues": [
"Bing.Search.v7",
"Bing.CustomSearch"
],
"metadata": {
"description": "Optional. This parameter will define Bing search kind."
}
},
"skuName": {
"type": "string",
"defaultValue": "F1",
"allowedValues": [
"F0",
"F1",
"S1",
"S2",
"S3",
"S4",
"S5",
"S6",
"S7",
"S8",
"S9"
],
"metadata": {
"description": "Optional. The name of the SKU, F* (free) and S* (standard). Supported SKUs will differ based on search kind"
}
},
"statisticsEnabled": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Optional. Enable or disable Bing statistics."
}
},
"tags": {
"type": "object",
"defaultValue": {},
"metadata": {
"description": "Optional. Tags of the resource."
}
}
},
"resources": [
{
"type": "Microsoft.Bing/accounts",
"apiVersion": "2020-06-10",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"kind": "[parameters('kind')]",
"properties": {
"statisticsEnabled": "[parameters('statisticsEnabled')]"
},
"sku": {
"name": "[parameters('skuName')]"
}
}
],
"outputs": {
"id": {
"type": "string",
"metadata": {
"description": "Bing account ID"
},
"value": "[resourceId('Microsoft.Bing/accounts', parameters('name'))]"
},
"endpoint": {
"type": "string",
"metadata": {
"description": "Bing Endpoint"
},
"value": "[reference(resourceId('Microsoft.Bing/accounts', parameters('name')), '2020-06-10').endpoint]"
}
}
}
6 changes: 6 additions & 0 deletions modules/ai/bing-resource/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-metadata-file-schema-v2#",
"name": "Bing Resource",
"summary": "This module deploys Azure Bing Resource",
"owner": "tanujbhatia1708"
}
33 changes: 33 additions & 0 deletions modules/ai/bing-resource/test/main.test.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Write deployment tests in this file. Any module that references the main
module file is a deployment test. Make sure at least one test is added.
*/

targetScope = 'resourceGroup'
// ===== //
// Tests //
// ===== //

// Test-01 - Bing Search v7 resource

module test_01_Bing '../main.bicep' = {
name: 'test_01_Bing_resource'
params: {
location: 'global'
kind: 'Bing.Search.v7'
name: 'Bing_SearchTest01'
skuName: 'S1'
}
}

// Test-02 - Bing Custom Search resource test

module test_02_Bing '../main.bicep' = {
name: 'test_02_Bing_resource'
params: {
location: 'global'
kind: 'Bing.CustomSearch'
name: 'Bing_SearchTest02'
skuName: 'S1'
}
}
8 changes: 8 additions & 0 deletions modules/ai/bing-resource/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "1.0",
"pathFilters": [
"./main.json",
"./metadata.json"
]
}