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

update the remote access example to include a log analytics workspace #472

Merged
merged 1 commit into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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