Skip to content

Commit

Permalink
update the remote access example to include a log analytics workspace (
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmusa authored Oct 20, 2021
1 parent dbec1c0 commit bfc675e
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 25 deletions.
14 changes: 11 additions & 3 deletions src/bicep/examples/remoteAccess/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,19 @@ az deployment sub show \
"type": "String",
"value": "/subscriptions/.../providers/Microsoft.Network/networkSecurityGroups/hub-nsg"
},
...
"logAnalyticsWorkspaceResourceId": {
"type": "String",
"value": "/subscriptions/.../providers/Microsoft.OperationalInsights/workspaces/mlz-dev-laws"
},
}
```

...and if you're on a BASH terminal, this command (take note to replace "myMlzDeployment" with your deployment name) will export the values as environment variables:

<!-- markdownlint-disable MD013 -->
```bash
export $(az deployment sub show --name "myMlzDeployment" --query "properties.outputs.{ args: [ join('', ['hubResourceGroupName=', hubResourceGroupName.value]), join('', ['hubVirtualNetworkName=', hubVirtualNetworkName.value]), join('', ['hubSubnetResourceId=', hubSubnetResourceId.value]), join('', ['hubNetworkSecurityGroupResourceId=', hubNetworkSecurityGroupResourceId.value]) ] }.args" --output tsv | xargs)
export $(az deployment sub show --name "myMlzDeployment" --query "properties.outputs.{ args: [ join('', ['hubResourceGroupName=', hubResourceGroupName.value]), join('', ['hubVirtualNetworkName=', hubVirtualNetworkName.value]), join('', ['hubSubnetResourceId=', hubSubnetResourceId.value]), join('', ['hubNetworkSecurityGroupResourceId=', hubNetworkSecurityGroupResourceId.value]), join('', ['logAnalyticsWorkspaceResourceId=', logAnalyticsWorkspaceResourceId.value]) ] }.args" --output tsv | xargs)
```
<!-- markdownlint-enable MD013 -->

Expand All @@ -98,8 +103,9 @@ hubResourceGroupName="mlz-dev-hub"
hubVirtualNetworkName="hub-vnet"
hubSubnetResourceId="/subscriptions/.../providers/Microsoft.Network/virtualNetworks/hub-vnet/subnets/hub-subnet"
hubNetworkSecurityGroupResourceId="/subscriptions/.../providers/Microsoft.Network/networkSecurityGroups/hub-nsg"
logAnalyticsWorkspaceResourceId="/subscriptions/.../providers/Microsoft.OperationalInsights/workspaces/mlz-dev-laws"

linuxPassword=$(openssl rand -base64 14) # generate a random 14 character password
my_password=$(openssl rand -base64 14) # generate a random 14 character password

az deployment group create \
--name "RemoteAccessExample" \
Expand All @@ -109,7 +115,9 @@ az deployment group create \
hubVirtualNetworkName="$hubVirtualNetworkName" \
hubSubnetResourceId="$hubSubnetResourceId" \
hubNetworkSecurityGroupResourceId="$hubNetworkSecurityGroupResourceId" \
linuxVmAdminPasswordOrKey="$linuxPassword"
logAnalyticsWorkspaceResourceId="$logAnalyticsWorkspaceResourceId" \
linuxVmAdminPasswordOrKey="$my_password" \
windowsVmAdminPassword="$my_password"
```

Or, completely experimentally, try the Portal:
Expand Down
3 changes: 3 additions & 0 deletions src/bicep/examples/remoteAccess/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param location string = resourceGroup().location
param hubVirtualNetworkName string
param hubSubnetResourceId string
param hubNetworkSecurityGroupResourceId string
param logAnalyticsWorkspaceResourceId string

param bastionHostName string = 'bastionHost'
param bastionHostSubnetAddressPrefix string = '10.0.100.160/27'
Expand Down Expand Up @@ -99,5 +100,7 @@ module remoteAccess '../../modules/remoteAccess.bicep' = {
windowsVmVersion: windowsVmVersion
windowsVmCreateOption: windowsVmCreateOption
windowsVmStorageAccountType: windowsVmStorageAccountType

logAnalyticsWorkspaceId: logAnalyticsWorkspaceResourceId
}
}
Loading

0 comments on commit bfc675e

Please sign in to comment.