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

Optional deployment of Private Networks, Private Endpoints plus optional configuration of an ACL rule for all backend services #864

Merged
merged 71 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b28f7a2
Add resources based on GitHub thread
tonybaloney Oct 12, 2023
491b1e1
Make the private endpoints an optional feature
tonybaloney Oct 12, 2023
df2fe2b
Use descriptive names
tonybaloney Oct 19, 2023
1125665
Fix provisioning of app service when use PE not enabled
tonybaloney Oct 19, 2023
a818b8a
Fix the bicep/ARM resolver order when not using PEs
tonybaloney Oct 19, 2023
6e3ecba
Update the instructions
tonybaloney Oct 19, 2023
afa94bb
App Service should go in subnet 2
tonybaloney Oct 19, 2023
afbbad4
Propagate tags and set default values for the PE DNS resources
tonybaloney Oct 19, 2023
0c05529
Propagate tags in the VNET
tonybaloney Oct 19, 2023
38a26d4
Work on a refactor closer to the RAG sample
tonybaloney Oct 20, 2023
015c094
Propagate network isolation flag to cog services
tonybaloney Oct 22, 2023
f7a2efb
Merge remote-tracking branch 'origin/main' into private_endpoint
tonybaloney Oct 22, 2023
9b882c2
clean up redundant args
tonybaloney Oct 23, 2023
f09b354
Merge branch 'main' into private_endpoint
tonybaloney Oct 26, 2023
852014f
Merge remote-tracking branch 'origin/main' into private_endpoint
tonybaloney Nov 7, 2023
a3e6ec5
Add an allowed hosts parameter and enable public network access when …
tonybaloney Nov 8, 2023
234d1a6
Update app service as well to have an allowlist setup
tonybaloney Nov 8, 2023
456640f
Add some explanation
tonybaloney Nov 8, 2023
63e5402
Merge branch 'main' into private_endpoint
tonybaloney Nov 8, 2023
16aa92e
Add link to other section
tonybaloney Nov 8, 2023
22ef2fe
Add an explanation about combining the two settings
tonybaloney Nov 8, 2023
e3a9708
Update README.md
tonybaloney Nov 8, 2023
e7551ac
Update README.md
tonybaloney Nov 8, 2023
f0e973f
Update README.md
tonybaloney Nov 8, 2023
644624d
Update README.md
tonybaloney Nov 8, 2023
3920b5e
Update names
tonybaloney Nov 8, 2023
5c3264f
Merge branch 'private_endpoint' of github.com:tonybaloney/azure-searc…
tonybaloney Nov 8, 2023
114adc7
Rename allow host to allow IP addresses
tonybaloney Nov 8, 2023
a152b76
Update links in README
tonybaloney Nov 8, 2023
fa00b27
Add the DNS zone and PE for CogServices/Form Recognizer
tonybaloney Nov 8, 2023
8f6a9ff
Readme tweaks (add to TOC, colocate)
pamelafox Nov 9, 2023
0bf85a6
Move config to the right location
pamelafox Nov 14, 2023
9b4f73b
Bicep formatting changes
pamelafox Nov 14, 2023
a4f44d2
Address Jons comments and change readme to only have vnet option
pamelafox Nov 14, 2023
87cbcea
Merge branch 'main' into private_endpoint
pamelafox Nov 14, 2023
3a06ec2
Check for CIDR for app service IP, alphabetize
pamelafox Nov 14, 2023
575f154
Merge branch 'private_endpoint' of https://github.com/tonybaloney/azu…
pamelafox Nov 14, 2023
180e289
Use lower case for search
tonybaloney Nov 14, 2023
d5ff641
Refactor vnet to make the subnets a parameter
tonybaloney Nov 15, 2023
fb19ef6
Merge branch 'main' into private_endpoint
pamelafox Nov 15, 2023
5326f84
Resolve some PR feedback
tonybaloney Nov 16, 2023
06ed516
Address outstanding PR feedback,
tonybaloney Nov 16, 2023
eca29f3
merge?
Mar 15, 2024
414350c
merge?
Apr 2, 2024
cb7c05b
update
mattgotteiner Apr 8, 2024
22a2d9c
Merge remote-tracking branch 'upstream/main' into matt/private_endpoint
mattgotteiner Apr 9, 2024
9f38f53
merge + fixes
mattgotteiner Apr 16, 2024
0db69f3
WIP
mattgotteiner Apr 26, 2024
78ac5ea
Merge remote-tracking branch 'upstream/main' into matt/private_endpoint
mattgotteiner Apr 26, 2024
7af5cc6
WIP
mattgotteiner Apr 29, 2024
e876449
still working on template
mattgotteiner Apr 30, 2024
3cf7551
remove unused comment; add param
mattgotteiner Apr 30, 2024
fdcd72e
fix error on no pe
mattgotteiner Apr 30, 2024
c6e9ff6
Merge remote-tracking branch 'origin/main' into private_endpoint
mattgotteiner May 9, 2024
8fb9ddd
working
mattgotteiner May 9, 2024
0822baa
update
mattgotteiner May 9, 2024
bd22012
refactoring
mattgotteiner May 10, 2024
bdeea06
adding docs
mattgotteiner May 10, 2024
d0d78e5
Conditional fixes
pamelafox May 10, 2024
8d01b58
Dont run prepdocs without network access
pamelafox May 10, 2024
72b5214
Apply suggestions from code review
pamelafox May 11, 2024
a464824
Update docs/deploy_private.md
pamelafox May 11, 2024
1f2f6e6
Update docs/deploy_private.md
pamelafox May 13, 2024
d397a20
addressing feedback
mattgotteiner May 13, 2024
cd09eb9
Merge branch 'private_endpoint' of https://github.com/tonybaloney/azu…
mattgotteiner May 13, 2024
7831e20
bicep lint; add os offer / publisher as params
mattgotteiner May 13, 2024
253ebb9
merge
mattgotteiner May 15, 2024
9e55db0
update docs
mattgotteiner May 15, 2024
93bb7a0
fixing bicep deployment
mattgotteiner May 15, 2024
b2394e3
remove locale
mattgotteiner May 15, 2024
ab63607
remove slow link
mattgotteiner May 15, 2024
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
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ These are advanced topics that are not necessary for a basic deployment.
* [Debugging the app on App Service](appservice.md)
* [Local development](localdev.md)
* [App customization](customization.md)
* [Private access](private.md)
* [Data ingestion](data_ingestion.md)
* [Productionizing](productionizing.md)
* [Alternative RAG chat samples](other_samples.md)
48 changes: 48 additions & 0 deletions docs/deploy_private.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

# Deploying with private access

If you want to disable public access when deploying the Chat App, you can do so by setting `azd` environment values.

## Before you begin

Deploying with public access disabled adds additional cost to your deployment. Please see pricing for the following products:

1. [Private Endpoints](https://azure.microsoft.com/pricing/details/private-link/)
1. The exact number of private endpoints created depends on the [optional features](./deploy_features.md) used.
1. [Private DNS Zones](https://azure.microsoft.com/pricing/details/dns/)
1. (Optional, but recommended)[Azure Virtual Machines](https://azure.microsoft.com/pricing/details/virtual-machines/windows/)
1. (Optional, but recommended)[Azure Bastion](https://azure.microsoft.com/pricing/details/azure-bastion/)

## Environment variables controlling private access

1. `AZURE_PUBLIC_NETWORK_ACCESS`: Controls the value of public network access on supported Azure resources. Valid values are 'Enabled' or 'Disabled'.
1. When public network access is 'Enabled', Azure resources are open to the internet.
1. When public network access is 'Disabled', Azure resources are only accessible over a virtual network.
1. `AZURE_USE_PRIVATE_ENDPOINT`: Controls deployment of [private endpoints](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) which connect Azure resources to the virtual network.
1. When set to 'true', ensures private endpoints are deployed for connectivity even when `AZURE_PUBLIC_NETWORK_ACCESS` is 'Disabled'.
1. Note that private endpoints do not make the chat app accessible from the internet. Connections must be initiated from inside the virtual network.
1. `AZURE_PROVISION_VM`: Controls deployment of a [virtual machine](https://learn.microsoft.com/azure/virtual-machines/overview) and [Azure Bastion](https://learn.microsoft.com/azure/bastion/bastion-overview). Azure Bastion allows you to securely connect to the virtual machine, without being connected virtual network. Since the virtual machine is connected to the virtual network, you are able to access the chat app.
1. You must set `AZURE_VM_USERNAME` and `AZURE_VM_PASSWORD` to provision the built-in administrator account with the virtual machine so you can log in through Azure Bastion.
1. By default, a server version of Windows is used for the VM. If you need to [enroll your device in Microsoft Intune](https://learn.microsoft.com/mem/intune/user-help/enroll-windows-10-device), you should use a desktop version of Windows by setting the following environment variables:
* `azd env set AZURE_VM_OS_PUBLISHER MicrosoftWindowsDesktop`
* `azd env set AZURE_VM_OS_OFFER Windows-11`
* `azd env set AZURE_VM_OS_VERSION win11-23h2-pro`

## Recommended deployment strategy for private access

1. Deploy the app with private endpoints enabled and public access enabled.
```
azd env set AZURE_USE_PRIVATE_ENDPOINT true
azd env set AZURE_PUBLIC_NETWORK_ACCESS Enabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have to be uppercase? Is it case sensitive? (I was surprised to see the capitalization, but I'm guessing it's because youre matching to an ARM value)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is case sensitive
https://learn.microsoft.com/en-us/azure/templates/microsoft.storage/storageaccounts?pivots=deployment-language-bicep

What we can do is accept a lower-cased "enabled" and fix it later (toUpper first letter and strcat it back?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not positive we should do this, since there's an advantage of matching the Bicep expectations, but we'll see if developers mess this up frequently.

azd up
```
2. Validate that you can connect to the chat app and it's working as expected from the internet.
3. Re-provision the app with public access disabled.
```
azd env set AZURE_PUBLIC_NETWORK_ACCESS Disabled
azd env set AZURE_PROVISION_VM true # Optional but recommended
azd env set AZURE_VM_USERNAME myadminusername # https://learn.microsoft.com/azure/virtual-machines/windows/faq#what-are-the-username-requirements-when-creating-a-vm-
azd env set AZURE_VM_PASSWORD mypassword # https://learn.microsoft.com/azure/virtual-machines/windows/faq#what-are-the-password-requirements-when-creating-a-vm-
azd provision
```
4. Log into your new VM using [Azure Bastion](https://learn.microsoft.com/azure/bastion/tutorial-create-host-portal#connect). Validate the chat app is accessible from the virtual machine using a web browser.
2 changes: 1 addition & 1 deletion docs/login_and_acl.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ In both the chat and ask a question modes, under **Developer settings** optional

The sample supports 2 main strategies for adding data with document level access control.

* [Using the Add Documents API](#using-the-add-documents-api). Sample scripts are provided which use the Azure AI Search Service [Add Documents API](https://learn.microsoft.com/rest/api/searchservice/documents/?view=rest-searchservice-2023-11-01&tabs=HTTP) to directly manage access control information on _existing documents_ in the index.
* [Using the Add Documents API](#using-the-add-documents-api). Sample scripts are provided which use the Azure AI Search Service Add Documents API to directly manage access control information on _existing documents_ in the index.
* [Using prepdocs and Azure Data Lake Storage Gen 2](#azure-data-lake-storage-gen2-setup). Sample scripts are provided which set up an [Azure Data Lake Storage Gen 2](https://learn.microsoft.com/azure/storage/blobs/data-lake-storage-introduction) account, set the [access control information](https://learn.microsoft.com/azure/storage/blobs/data-lake-storage-access-control) on files and folders stored there, and ingest those documents into the search index with their access control information.

### Using the Add Documents API
Expand Down
2 changes: 1 addition & 1 deletion docs/productionizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ and scale up the maximum/minimum based on load.
* **Authentication**: By default, the deployed app is publicly accessible.
We recommend restricting access to authenticated users.
See [Enabling authentication](./deploy_features.md#enabling-authentication) to learn how to enable authentication.
* **Networking**: We recommend deploying inside a Virtual Network. If the app is only for
* **Networking**: We recommend [deploying inside a Virtual Network](./deploy_private.md). If the app is only for
internal enterprise use, use a private DNS zone. Also consider using Azure API Management (APIM)
for firewalls and other forms of protection.
For more details, read [Azure OpenAI Landing Zone reference architecture](https://techcommunity.microsoft.com/t5/azure-architecture-blog/azure-openai-landing-zone-reference-architecture/ba-p/3882102).
Expand Down
3 changes: 3 additions & 0 deletions infra/abbreviations.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"operationalInsightsWorkspaces": "log-",
"portalDashboards": "dash-",
"powerBIDedicatedCapacities": "pbi-",
"privateEndpoint": "pe-",
"privateLink": "pl-",
"purviewAccounts": "pview-",
"recoveryServicesVaults": "rsv-",
"resourcesResourceGroups": "rg-",
Expand All @@ -129,6 +131,7 @@
"synapseWorkspacesSqlPoolsDedicated": "syndp",
"synapseWorkspacesSqlPoolsSpark": "synsp",
"timeSeriesInsightsEnvironments": "tsi-",
"virtualNetworks": "vnet-",
"webServerFarms": "plan-",
"webSitesAppService": "app-",
"webSitesAppServiceEnvironment": "ase-",
Expand Down
21 changes: 13 additions & 8 deletions infra/core/ai/cognitiveservices.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,29 @@ param publicNetworkAccess string = 'Enabled'
param sku object = {
name: 'S0'
}
param ipRules array = []
@allowed([ 'None', 'AzureServices' ])
param bypass string = 'None'

param allowedIpRules array = []
param networkAcls object = empty(allowedIpRules) ? {
var networkAcls = {
defaultAction: 'Allow'
} : {
ipRules: allowedIpRules
defaultAction: 'Deny'
}

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
var networkAclsWithBypass = {
defaultAction: 'Allow'
bypass: bypass
}

resource account 'Microsoft.CognitiveServices/accounts@2023-10-01-preview' = {
name: name
location: location
tags: tags
kind: kind
properties: {
customSubDomainName: customSubDomainName
publicNetworkAccess: publicNetworkAccess
networkAcls: networkAcls
// Document Intelligence (FormRecognizer) does not support bypass in network acls
networkAcls: kind == 'FormRecognizer' ? networkAcls : networkAclsWithBypass
Dismissed Show dismissed Hide dismissed
disableLocalAuth: disableLocalAuth
}
sku: sku
Expand All @@ -52,4 +57,4 @@ resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01

output endpoint string = account.properties.endpoint
output id string = account.id
output name string = account.name
output name string = account.name
64 changes: 38 additions & 26 deletions infra/core/host/appservice.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ param applicationInsightsName string = ''
param appServicePlanId string
param keyVaultName string = ''
param managedIdentity bool = !empty(keyVaultName)
param virtualNetworkSubnetId string = ''

// Runtime Properties
@allowed([
Expand Down Expand Up @@ -44,44 +45,54 @@ param serverAppId string = ''
@secure()
param clientSecretSettingName string = ''
param authenticationIssuerUri string = ''
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccess string = 'Enabled'
param enableUnauthenticatedAccess bool = false

var msftAllowedOrigins = [ 'https://portal.azure.com', 'https://ms.portal.azure.com' ]
var loginEndpoint = environment().authentication.loginEndpoint
var loginEndpointFixed = lastIndexOf(loginEndpoint, '/') == length(loginEndpoint) - 1 ? substring(loginEndpoint, 0, length(loginEndpoint) - 1) : loginEndpoint
var allMsftAllowedOrigins = !(empty(clientAppId)) ? union(msftAllowedOrigins, [loginEndpointFixed]) : msftAllowedOrigins
var allMsftAllowedOrigins = !(empty(clientAppId)) ? union(msftAllowedOrigins, [ loginEndpointFixed ]) : msftAllowedOrigins

// .default must be the 1st scope for On-Behalf-Of-Flow combined consent to work properly
// Please see https://learn.microsoft.com/entra/identity-platform/v2-oauth2-on-behalf-of-flow#default-and-combined-consent
var requiredScopes = ['api://${serverAppId}/.default', 'openid', 'profile', 'email', 'offline_access']
var requiredAudiences = ['api://${serverAppId}']
var requiredScopes = [ 'api://${serverAppId}/.default', 'openid', 'profile', 'email', 'offline_access' ]
var requiredAudiences = [ 'api://${serverAppId}' ]

var coreConfig = {
linuxFxVersion: linuxFxVersion
alwaysOn: alwaysOn
ftpsState: ftpsState
appCommandLine: appCommandLine
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
minTlsVersion: '1.2'
use32BitWorkerProcess: use32BitWorkerProcess
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
healthCheckPath: healthCheckPath
cors: {
allowedOrigins: union(allMsftAllowedOrigins, allowedOrigins)
}
}

var appServiceProperties = {
serverFarmId: appServicePlanId
siteConfig: coreConfig
clientAffinityEnabled: clientAffinityEnabled
httpsOnly: true
// Always route traffic through the vnet
// See https://learn.microsoft.com/azure/app-service/configure-vnet-integration-routing#configure-application-routing
vnetRouteAllEnabled: !empty(virtualNetworkSubnetId)
virtualNetworkSubnetId: !empty(virtualNetworkSubnetId) ? virtualNetworkSubnetId : null
publicNetworkAccess: publicNetworkAccess
}

resource appService 'Microsoft.Web/sites@2022-03-01' = {
name: name
location: location
tags: tags
kind: kind
properties: {
serverFarmId: appServicePlanId
siteConfig: {
linuxFxVersion: linuxFxVersion
alwaysOn: alwaysOn
ftpsState: ftpsState
minTlsVersion: '1.2'
appCommandLine: appCommandLine
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
use32BitWorkerProcess: use32BitWorkerProcess
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
healthCheckPath: healthCheckPath
cors: {
allowedOrigins: union(allMsftAllowedOrigins, allowedOrigins)
}
}
clientAffinityEnabled: clientAffinityEnabled
httpsOnly: true
}

properties: appServiceProperties
identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }

resource configAppSettings 'config' = {
Expand All @@ -91,7 +102,7 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
SCM_DO_BUILD_DURING_DEPLOYMENT: string(scmDoBuildDuringDeployment)
ENABLE_ORYX_BUILD: string(enableOryxBuild)
},
runtimeName == 'python' ? { PYTHON_ENABLE_GUNICORN_MULTIWORKERS: 'true'} : {},
runtimeName == 'python' ? { PYTHON_ENABLE_GUNICORN_MULTIWORKERS: 'true' } : {},
!empty(applicationInsightsName) ? { APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString } : {},
!empty(keyVaultName) ? { AZURE_KEY_VAULT_ENDPOINT: keyVault.properties.vaultUri } : {})
}
Expand Down Expand Up @@ -140,7 +151,7 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
openIdIssuer: authenticationIssuerUri
}
login: {
loginParameters: ['scope=${join(union(requiredScopes, additionalScopes), ' ')}']
loginParameters: [ 'scope=${join(union(requiredScopes, additionalScopes), ' ')}' ]
}
validation: {
allowedAudiences: union(requiredAudiences, additionalAllowedAudiences)
Expand All @@ -167,6 +178,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing
name: applicationInsightsName
}

output id string = appService.id
output identityPrincipalId string = managedIdentity ? appService.identity.principalId : ''
output name string = appService.name
output uri string = 'https://${appService.properties.defaultHostName}'
68 changes: 68 additions & 0 deletions infra/core/host/vm.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
param name string
param location string
param vmSize string = 'Standard_DS1_v2'
param adminUsername string
@secure()
param adminPassword string
param osVersion string = '2022-datacenter-azure-edition'
param osPublisher string = 'MicrosoftWindowsServer'
param osOffer string = 'WindowsServer'
param nicId string
param securityType string = 'TrustedLaunch'

var securityProfileJson = {
uefiSettings: {
secureBootEnabled: true
vTpmEnabled: true
}
securityType: securityType
}

resource vm 'Microsoft.Compute/virtualMachines@2022-03-01' = {
name: name
location: location
properties: {
hardwareProfile: {
vmSize: vmSize
}
osProfile: {
computerName: name
adminUsername: adminUsername
adminPassword: adminPassword
}
storageProfile: {
imageReference: {
publisher: osPublisher
offer: osOffer
sku: osVersion
version: 'latest'
}
osDisk: {
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'StandardSSD_LRS'
}
}
dataDisks: [
{
diskSizeGB: 1023
lun: 0
createOption: 'Empty'
}
]
}
networkProfile: {
networkInterfaces: [
{
id: nicId
}
]
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
}
}
securityProfile: ((securityType == 'TrustedLaunch') ? securityProfileJson : null)
}
}
9 changes: 8 additions & 1 deletion infra/core/monitor/applicationinsights.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ param dashboardName string = ''
param location string = resourceGroup().location
param tags object = {}
param logAnalyticsWorkspaceId string
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccessForIngestion string = 'Enabled'
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccessForQuery string = 'Enabled'

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: name
Expand All @@ -13,10 +17,12 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
properties: {
Application_Type: 'web'
WorkspaceResourceId: logAnalyticsWorkspaceId
publicNetworkAccessForIngestion: publicNetworkAccessForIngestion
publicNetworkAccessForQuery: publicNetworkAccessForQuery
}
}

module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (!empty(dashboardName)) {
module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (!empty(dashboardName)) {
name: 'application-insights-dashboard'
params: {
name: dashboardName
Expand All @@ -28,3 +34,4 @@ module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if
output connectionString string = applicationInsights.properties.ConnectionString
output instrumentationKey string = applicationInsights.properties.InstrumentationKey
output name string = applicationInsights.name
output id string = applicationInsights.id
12 changes: 9 additions & 3 deletions infra/core/monitor/loganalytics.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@ metadata description = 'Creates a Log Analytics workspace.'
param name string
param location string = resourceGroup().location
param tags object = {}
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccessForIngestion string = 'Enabled'
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccessForQuery string = 'Enabled'

resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = {
name: name
location: location
tags: tags
properties: any({
properties: {
retentionInDays: 30
features: {
searchVersion: 1
}
sku: {
name: 'PerGB2018'
}
})
publicNetworkAccessForIngestion: publicNetworkAccessForIngestion
publicNetworkAccessForQuery: publicNetworkAccessForQuery
}
}

output id string = logAnalytics.id
output name string = logAnalytics.name
output name string = logAnalytics.name
Loading
Loading