-
Notifications
You must be signed in to change notification settings - Fork 437
[Modules] Updated MachineLearningServices workspaces to new dependency approach #1881
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
Merged
AlexanderSehr
merged 20 commits into
main
from
users/alsehr/1791_MachineLearningServices_workspaces
Oct 17, 2022
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7616169
Updated MachineLearningServices workspaces to new dependency approach
AlexanderSehr 55cc021
Update to latest
AlexanderSehr cc9d7b2
Tried different set of permissions
AlexanderSehr 2aebd4f
Adjusted permissions
AlexanderSehr d2e2162
Updated encr
AlexanderSehr 0bce4f7
Updated folder default to common.
AlexanderSehr 059a723
Update to latest
AlexanderSehr 1601d32
Update to latest
AlexanderSehr b8319ce
Update to latest
AlexanderSehr 5cd5033
Update to latest
AlexanderSehr d169c44
Update modules/Microsoft.MachineLearningServices/workspaces/.test/com…
AlexanderSehr 0d760bc
Update modules/Microsoft.MachineLearningServices/workspaces/.test/enc…
AlexanderSehr 4bdc701
Update modules/Microsoft.MachineLearningServices/workspaces/.test/min…
AlexanderSehr 6f5f84f
Update modules/Microsoft.MachineLearningServices/workspaces/.test/com…
AlexanderSehr 97c9cab
Update modules/Microsoft.MachineLearningServices/workspaces/.test/enc…
AlexanderSehr a07d658
Update to latest
AlexanderSehr 0258696
Merge branch 'users/alsehr/1791_MachineLearningServices_workspaces' o…
AlexanderSehr cfc937c
Update to latest
AlexanderSehr a6a7563
Addressed comments
AlexanderSehr 87a64bb
Update to latest
AlexanderSehr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
modules/Microsoft.MachineLearningServices/workspaces/.test/common/dependencies.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| @description('Optional. The location to deploy to.') | ||
| param location string = resourceGroup().location | ||
|
|
||
| @description('Required. The name of the Virtual Network to create.') | ||
| param virtualNetworkName string | ||
|
|
||
| @description('Required. The name of the Key Vault to create.') | ||
| param keyVaultName string | ||
|
|
||
| @description('Required. The name of the Managed Identity to create.') | ||
| param managedIdentityName string | ||
|
|
||
| @description('Required. The name of the Application Insights instance to create.') | ||
| param applicationInsightsName string | ||
|
|
||
| @description('Required. The name of the Storage Account to create.') | ||
| param storageAccountName string | ||
|
|
||
| resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = { | ||
| name: virtualNetworkName | ||
| location: location | ||
| properties: { | ||
| addressSpace: { | ||
| addressPrefixes: [ | ||
| '10.0.0.0/24' | ||
| ] | ||
| } | ||
| subnets: [ | ||
| { | ||
| name: 'defaultSubnet' | ||
| properties: { | ||
| addressPrefix: '10.0.0.0/24' | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = { | ||
| name: keyVaultName | ||
| location: location | ||
| properties: { | ||
| sku: { | ||
| family: 'A' | ||
| name: 'standard' | ||
| } | ||
| tenantId: tenant().tenantId | ||
| enablePurgeProtection: null | ||
| enabledForTemplateDeployment: true | ||
| enabledForDiskEncryption: true | ||
| enabledForDeployment: true | ||
| enableRbacAuthorization: true | ||
| accessPolicies: [] | ||
| } | ||
| } | ||
|
|
||
| resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | ||
| name: managedIdentityName | ||
| location: location | ||
| } | ||
|
|
||
| resource keyVaultServicePermissions 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
| name: guid('msi-${keyVault.id}-${location}-${managedIdentity.id}-KeyVault-Contributor-RoleAssignment') | ||
| scope: keyVault | ||
| properties: { | ||
| principalId: managedIdentity.properties.principalId | ||
| roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') // Contributor | ||
| principalType: 'ServicePrincipal' | ||
| } | ||
| } | ||
| resource keyVaultDataPermissions 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
| name: guid('msi-${keyVault.id}-${location}-${managedIdentity.id}-KeyVault-Data-Admin-RoleAssignment') | ||
| scope: keyVault | ||
| properties: { | ||
| principalId: managedIdentity.properties.principalId | ||
| roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '00482a5a-887f-4fb3-b363-3b7fe8e74483') // Key Vault Administrator | ||
| principalType: 'ServicePrincipal' | ||
| } | ||
| } | ||
|
|
||
| resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { | ||
| name: applicationInsightsName | ||
| location: location | ||
| kind: '' | ||
| properties: {} | ||
| } | ||
|
|
||
| resource storageAccount 'Microsoft.Storage/storageAccounts@2021-09-01' = { | ||
| name: storageAccountName | ||
| location: location | ||
| sku: { | ||
| name: 'Standard_LRS' | ||
| } | ||
| kind: 'StorageV2' | ||
| } | ||
|
|
||
| resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = { | ||
| name: 'privatelink.api.azureml.ms' | ||
| location: 'global' | ||
|
|
||
| resource virtualNetworkLinks 'virtualNetworkLinks@2020-06-01' = { | ||
| name: '${virtualNetwork.name}-vnetlink' | ||
| location: 'global' | ||
| properties: { | ||
| virtualNetwork: { | ||
| id: virtualNetwork.id | ||
| } | ||
| registrationEnabled: false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @description('The resource ID of the created Virtual Network Subnet.') | ||
| output subnetResourceId string = virtualNetwork.properties.subnets[0].id | ||
|
|
||
| @description('The resource ID of the created Key Vault.') | ||
| output keyVaultResourceId string = keyVault.id | ||
|
|
||
| @description('The principal ID of the created Managed Identity.') | ||
| output managedIdentityPrincipalId string = managedIdentity.properties.principalId | ||
|
|
||
| @description('The resource ID of the created Managed Identity.') | ||
| output managedIdentityResourceId string = managedIdentity.id | ||
|
|
||
| @description('The resource ID of the created Application Insights instance.') | ||
| output applicationInsightsResourceId string = applicationInsights.id | ||
|
|
||
| @description('The resource ID of the created Storage Account.') | ||
| output storageAccountResourceId string = storageAccount.id | ||
|
|
||
| @description('The resource ID of the created Private DNS Zone.') | ||
| output privateDNSZoneResourceId string = privateDNSZone.id | ||
129 changes: 129 additions & 0 deletions
129
modules/Microsoft.MachineLearningServices/workspaces/.test/common/deploy.test.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| targetScope = 'subscription' | ||
|
|
||
| // ========== // | ||
| // Parameters // | ||
| // ========== // | ||
| @description('Optional. The name of the resource group to deploy for testing purposes.') | ||
| @maxLength(90) | ||
| param resourceGroupName string = 'ms.machinelearningservices.workspaces-${serviceShort}-rg' | ||
|
|
||
| @description('Optional. The location to deploy resources to.') | ||
| param location string = deployment().location | ||
|
|
||
| @description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') | ||
| param serviceShort string = 'mlswcom' | ||
|
|
||
| // =========== // | ||
| // Deployments // | ||
| // =========== // | ||
|
|
||
| // General resources | ||
| // ================= | ||
| resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { | ||
| name: resourceGroupName | ||
| location: location | ||
| } | ||
|
|
||
| module resourceGroupResources 'dependencies.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name, location)}-paramNested' | ||
| params: { | ||
| virtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}' | ||
| managedIdentityName: 'dep-<<namePrefix>>-msi-${serviceShort}' | ||
| keyVaultName: 'dep-<<namePrefix>>-kv-${serviceShort}' | ||
| applicationInsightsName: 'dep-<<namePrefix>>-appi-${serviceShort}' | ||
| storageAccountName: 'dep<<namePrefix>>st${serviceShort}' | ||
| } | ||
| } | ||
|
|
||
| // Diagnostics | ||
| // =========== | ||
| module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' | ||
| params: { | ||
| storageAccountName: 'dep<<namePrefix>>diasa${serviceShort}01' | ||
| logAnalyticsWorkspaceName: 'dep-<<namePrefix>>-law-${serviceShort}' | ||
| eventHubNamespaceEventHubName: 'dep-<<namePrefix>>-evh-${serviceShort}' | ||
| eventHubNamespaceName: 'dep-<<namePrefix>>-evhns-${serviceShort}' | ||
| location: location | ||
| } | ||
| } | ||
|
|
||
| // ============== // | ||
| // Test Execution // | ||
| // ============== // | ||
|
|
||
| module testDeployment '../../deploy.bicep' = { | ||
| scope: resourceGroup | ||
| name: '${uniqueString(deployment().name)}-test-${serviceShort}' | ||
| params: { | ||
| name: '<<namePrefix>>${serviceShort}001' | ||
| associatedApplicationInsightsResourceId: resourceGroupResources.outputs.applicationInsightsResourceId | ||
| associatedKeyVaultResourceId: resourceGroupResources.outputs.keyVaultResourceId | ||
| associatedStorageAccountResourceId: resourceGroupResources.outputs.storageAccountResourceId | ||
| sku: 'Basic' | ||
| computes: [ | ||
| { | ||
| computeLocation: 'westeurope' | ||
| computeType: 'AmlCompute' | ||
| description: 'Default CPU Cluster' | ||
| disableLocalAuth: false | ||
| location: 'westeurope' | ||
| name: 'DefaultCPU' | ||
| properties: { | ||
| enableNodePublicIp: true | ||
| isolatedNetwork: false | ||
| osType: 'Linux' | ||
| remoteLoginPortPublicAccess: 'Disabled' | ||
| scaleSettings: { | ||
| maxNodeCount: 3 | ||
| minNodeCount: 0 | ||
| nodeIdleTimeBeforeScaleDown: 'PT5M' | ||
| } | ||
| vmPriority: 'Dedicated' | ||
| vmSize: 'STANDARD_DS11_V2' | ||
| } | ||
| sku: 'Basic' | ||
| // Must be false if `primaryUserAssignedIdentity` is provided | ||
| systemAssignedIdentity: false | ||
| userAssignedIdentities: { | ||
| '${resourceGroupResources.outputs.managedIdentityResourceId}': {} | ||
| } | ||
| } | ||
| ] | ||
| description: 'The cake is a lie.' | ||
| diagnosticLogsRetentionInDays: 7 | ||
| diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId | ||
| diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId | ||
| diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId | ||
| diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName | ||
| discoveryUrl: 'http://example.com' | ||
| imageBuildCompute: 'testcompute' | ||
| lock: 'CanNotDelete' | ||
| primaryUserAssignedIdentity: resourceGroupResources.outputs.managedIdentityResourceId | ||
| privateEndpoints: [ | ||
eriqua marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| service: 'amlworkspace' | ||
| subnetResourceId: resourceGroupResources.outputs.subnetResourceId | ||
| privateDnsZoneGroup: { | ||
| privateDNSResourceIds: [ | ||
| resourceGroupResources.outputs.privateDNSZoneResourceId | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| roleAssignments: [ | ||
| { | ||
| principalIds: [ | ||
| resourceGroupResources.outputs.managedIdentityPrincipalId | ||
| ] | ||
| roleDefinitionIdOrName: 'Reader' | ||
| } | ||
| ] | ||
| systemAssignedIdentity: false | ||
| userAssignedIdentities: { | ||
| '${resourceGroupResources.outputs.managedIdentityResourceId}': {} | ||
| } | ||
| } | ||
| } | ||
54 changes: 0 additions & 54 deletions
54
modules/Microsoft.MachineLearningServices/workspaces/.test/encr.parameters.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.