-
Notifications
You must be signed in to change notification settings - Fork 437
[Modules] Added NetworkInterface module #1400
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
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ae667a6
Created first version of NIC module
AlexanderSehr bfaef3e
Update to latest
AlexanderSehr 5d7126b
Update to latest
AlexanderSehr efef407
Update to latest
AlexanderSehr cd011d3
Update to latest
AlexanderSehr 581abe1
Updated tests
AlexanderSehr 5f9f4c5
dummy change
AlexanderSehr 5d6ae18
Update to latest
AlexanderSehr d2c584c
Update to latest
AlexanderSehr a05645d
Minor update
AlexanderSehr 1794101
Update to latest
AlexanderSehr 09fdb8c
Update to latest
AlexanderSehr 1d18e73
Added diagnostic settings + cleanup
AlexanderSehr 279f012
Update to latest
AlexanderSehr 263c24f
Update arm/Microsoft.Network/networkInterfaces/deploy.bicep
AlexanderSehr 78ffcf8
Update to latest
AlexanderSehr cf40cc7
Update .github/workflows/ms.network.networkinterfaces.yml
AlexanderSehr 224ed07
Update .github/workflows/ms.network.networkinterfaces.yml
AlexanderSehr eef85ad
Update .azuredevops/modulePipelines/ms.network.networkinterfaces.yml
AlexanderSehr 7ac144d
Update arm/Microsoft.Network/networkInterfaces/deploy.bicep
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
55 changes: 55 additions & 0 deletions
55
.azuredevops/modulePipelines/ms.network.networkinterfaces.yml
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,55 @@ | ||
| name: 'Network - NetworkInterfaces' | ||
|
|
||
| parameters: | ||
| - name: removeDeployment | ||
| displayName: Remove deployed module | ||
| type: boolean | ||
| default: true | ||
| - name: prerelease | ||
| displayName: Publish prerelease module | ||
| type: boolean | ||
| default: false | ||
|
|
||
| pr: none | ||
|
|
||
| trigger: | ||
| batch: true | ||
| branches: | ||
| include: | ||
| - main | ||
| paths: | ||
| include: | ||
| - '/.azuredevops/modulePipelines/ms.network.networkinterfaces.yml' | ||
| - '/.azuredevops/pipelineTemplates/module.*.yml' | ||
| - '/arm/Microsoft.Network/networkInterfaces/*' | ||
| - '/arm/.global/global.module.tests.ps1' | ||
| exclude: | ||
| - '/**/*.md' | ||
|
|
||
| variables: | ||
| - template: '../../global.variables.yml' | ||
| - group: 'PLATFORM_VARIABLES' | ||
| - name: modulePath | ||
| value: '/arm/Microsoft.Network/networkInterfaces' | ||
|
|
||
| stages: | ||
| - stage: Validation | ||
| displayName: Static validation | ||
| jobs: | ||
| - template: /.azuredevops/pipelineTemplates/jobs.validateModulePester.yml | ||
|
|
||
| - stage: Deployment | ||
| displayName: Deployment validation | ||
| jobs: | ||
| - template: /.azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml | ||
| parameters: | ||
| removeDeployment: '${{ parameters.removeDeployment }}' | ||
| deploymentBlocks: | ||
| - path: $(modulePath)/.parameters/min.parameters.json | ||
| - path: $(modulePath)/.parameters/parameters.json | ||
|
|
||
| - stage: Publishing | ||
| displayName: Publishing | ||
| condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq('${{ parameters.prerelease }}', 'true'))) | ||
| jobs: | ||
| - template: /.azuredevops/pipelineTemplates/jobs.publishModule.yml |
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,142 @@ | ||
| name: 'Network: NetworkInterfaces' | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| removeDeployment: | ||
| type: boolean | ||
| description: 'Remove deployed module' | ||
| required: false | ||
| default: true | ||
| prerelease: | ||
| type: boolean | ||
| description: 'Publish prerelease module' | ||
| required: false | ||
| default: false | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - '.github/actions/templates/**' | ||
| - '.github/workflows/ms.network.networkinterfaces.yml' | ||
| - 'arm/Microsoft.Network/networkInterfaces/**' | ||
| - 'arm/.global/global.module.tests.ps1' | ||
| - '!*/**/readme.md' | ||
| - 'utilities/pipelines/**' | ||
| - '!utilities/pipelines/dependencies/**' | ||
|
|
||
| env: | ||
| variablesPath: 'global.variables.yml' | ||
| modulePath: 'arm/Microsoft.Network/networkInterfaces' | ||
| workflowPath: '.github/workflows/ms.network.networkinterfaces.yml' | ||
| AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} | ||
| ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}' | ||
| ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}' | ||
| ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}' | ||
| DEPLOYMENT_SP_ID: '${{ secrets.DEPLOYMENT_SP_ID }}' | ||
|
|
||
| jobs: | ||
| ########################### | ||
| # Initialize pipeline # | ||
| ########################### | ||
| job_initialize_pipeline: | ||
| runs-on: ubuntu-20.04 | ||
| name: 'Initialize pipeline' | ||
| steps: | ||
| - name: 'Checkout' | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Set input parameters to output variables' | ||
| id: get-workflow-param | ||
| uses: ./.github/actions/templates/getWorkflowInput | ||
| with: | ||
| workflowPath: '${{ env.workflowPath}}' | ||
| - name: 'Get parameter file paths' | ||
| id: get-parameter-file-paths | ||
| uses: ./.github/actions/templates/getParameterFiles | ||
| with: | ||
| modulePath: '${{ env.modulePath }}' | ||
| outputs: | ||
| removeDeployment: ${{ steps.get-workflow-param.outputs.removeDeployment }} | ||
| parameterFilePaths: ${{ steps.get-parameter-file-paths.outputs.parameterFilePaths }} | ||
|
|
||
| ######################### | ||
| # Static validation # | ||
| ######################### | ||
| job_module_pester_validation: | ||
| runs-on: ubuntu-20.04 | ||
| name: 'Static validation' | ||
| steps: | ||
| - name: 'Checkout' | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Run tests' | ||
| uses: ./.github/actions/templates/validateModulePester | ||
| with: | ||
| modulePath: '${{ env.modulePath }}' | ||
|
|
||
| ############################# | ||
| # Deployment validation # | ||
| ############################# | ||
| job_module_deploy_validation: | ||
| runs-on: ubuntu-20.04 | ||
| name: 'Deployment validation' | ||
| needs: | ||
| - job_initialize_pipeline | ||
| - job_module_pester_validation | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| parameterFilePaths: ${{ fromJSON(needs.job_initialize_pipeline.outputs.parameterFilePaths) }} | ||
| steps: | ||
| - name: 'Checkout' | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set environment variables | ||
| uses: ./.github/actions/templates/setEnvironmentVariables | ||
| with: | ||
| variablesPath: ${{ env.variablesPath }} | ||
| - name: 'Using parameter file [${{ matrix.parameterFilePaths }}]' | ||
| uses: ./.github/actions/templates/validateModuleDeployment | ||
| with: | ||
| templateFilePath: '${{ env.modulePath }}/deploy.bicep' | ||
| parameterFilePath: '${{ env.modulePath }}/${{ matrix.parameterFilePaths }}' | ||
| location: '${{ env.location }}' | ||
| resourceGroupName: '${{ env.resourceGroupName }}' | ||
| subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' | ||
| managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' | ||
| removeDeployment: '${{ needs.job_initialize_pipeline.outputs.removeDeployment }}' | ||
|
|
||
| ################## | ||
| # Publishing # | ||
| ################## | ||
| job_publish_module: | ||
| name: 'Publishing' | ||
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event.inputs.prerelease == 'true' | ||
| runs-on: ubuntu-20.04 | ||
| needs: | ||
| - job_module_deploy_validation | ||
| steps: | ||
| - name: 'Checkout' | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set environment variables | ||
| uses: ./.github/actions/templates/setEnvironmentVariables | ||
| with: | ||
| variablesPath: ${{ env.variablesPath }} | ||
| - name: 'Publishing' | ||
| uses: ./.github/actions/templates/publishModule | ||
| with: | ||
| templateFilePath: '${{ env.modulePath }}/deploy.bicep' | ||
| templateSpecsRGName: '${{ env.templateSpecsRGName }}' | ||
| templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}' | ||
| templateSpecsDescription: '${{ env.templateSpecsDescription }}' | ||
| templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}' | ||
| bicepRegistryName: '${{ env.bicepRegistryName }}' | ||
| bicepRegistryRGName: '${{ env.bicepRegistryRGName }}' | ||
| bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}' | ||
| bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}' |
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
63 changes: 63 additions & 0 deletions
63
arm/Microsoft.Network/networkInterfaces/.bicep/nested_rbac.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,63 @@ | ||
| @sys.description('Required. The IDs of the principals to assign the role to.') | ||
| param principalIds array | ||
|
|
||
| @sys.description('Required. The name of the role to assign. If it cannot be found you can specify the role definition ID instead.') | ||
| param roleDefinitionIdOrName string | ||
|
|
||
| @sys.description('Required. The resource ID of the resource to apply the role assignment to.') | ||
| param resourceId string | ||
|
|
||
| @sys.description('Optional. The principal type of the assigned principal ID.') | ||
| @allowed([ | ||
| 'ServicePrincipal' | ||
| 'Group' | ||
| 'User' | ||
| 'ForeignGroup' | ||
| 'Device' | ||
| '' | ||
| ]) | ||
| param principalType string = '' | ||
|
|
||
| @sys.description('Optional. The description of the role assignment.') | ||
| param description string = '' | ||
|
|
||
| var builtInRoleNames = { | ||
| 'Owner': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635') | ||
| 'Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') | ||
| 'Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7') | ||
| 'Avere Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4f8fab4f-1852-4a58-a46a-8eaf358af14a') | ||
| 'Avere Operator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c025889f-8102-4ebf-b32c-fc0c6f0c6bd9') | ||
| 'DevTest Labs User': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '76283e04-6283-4c54-8f91-bcf1374a3c64') | ||
| 'Domain Services Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'eeaeda52-9324-47f6-8069-5d5bade478b2') | ||
| 'Domain Services Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '361898ef-9ed1-48c2-849c-a832951106bb') | ||
| 'Log Analytics Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '92aaf0da-9dab-42b6-94a3-d43ce8d16293') | ||
| 'Log Analytics Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '73c42c96-874c-492b-b04d-ab87d138a893') | ||
| 'Managed Application Contributor Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '641177b8-a67a-45b9-a033-47bc880bb21e') | ||
| 'Managed Application Operator Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c7393b34-138c-406f-901b-d8cf2b17e6ae') | ||
| 'Managed Applications Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b9331d33-8a36-4f8c-b097-4f54124fdb44') | ||
| 'Monitoring Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '749f88d5-cbae-40b8-bcfc-e573ddc772fa') | ||
| 'Monitoring Metrics Publisher': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '3913510d-42f4-4e42-8a64-420c390055eb') | ||
| 'Monitoring Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '43d0d8ad-25c7-4714-9337-8ba259a9fe05') | ||
| 'Network Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4d97b98b-1d4f-4787-a291-c67834d212e7') | ||
| 'Resource Policy Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '36243c78-bf99-498c-9df9-86d9f8d28608') | ||
| 'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9') | ||
| 'Virtual Machine Administrator Login': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '1c0163c0-47e6-4577-8991-ea5c82e286e4') | ||
| 'Virtual Machine Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '9980e02c-c2be-4d73-94e8-173b1dc7cf3c') | ||
| 'Virtual Machine User Login': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'fb879df8-f326-4884-b1cf-06f3ad86be52') | ||
| 'Windows Admin Center Administrator Login': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a6333a3e-0164-44c3-b281-7a577aff287f') | ||
| } | ||
|
|
||
| resource networkInterface 'Microsoft.Network/networkInterfaces@2021-08-01' existing = { | ||
| name: last(split(resourceId, '/')) | ||
| } | ||
|
|
||
| resource roleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = [for principalId in principalIds: { | ||
| name: guid(networkInterface.id, principalId, roleDefinitionIdOrName) | ||
| properties: { | ||
| description: description | ||
| roleDefinitionId: contains(builtInRoleNames, roleDefinitionIdOrName) ? builtInRoleNames[roleDefinitionIdOrName] : roleDefinitionIdOrName | ||
| principalId: principalId | ||
| principalType: any(!empty(principalType) ? principalType : null) | ||
| } | ||
| scope: networkInterface | ||
| }] |
17 changes: 17 additions & 0 deletions
17
arm/Microsoft.Network/networkInterfaces/.parameters/min.parameters.json
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,17 @@ | ||
| { | ||
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
| "contentVersion": "1.0.0.0", | ||
| "parameters": { | ||
| "name": { | ||
| "value": "<<namePrefix>>-az-nic-min-001" | ||
| }, | ||
| "ipConfigurations": { | ||
| "value": [ | ||
| { | ||
| "name": "ipconfig01", | ||
| "subnetId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-001/subnets/<<namePrefix>>-az-subnet-x-001" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
52 changes: 52 additions & 0 deletions
52
arm/Microsoft.Network/networkInterfaces/.parameters/parameters.json
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,52 @@ | ||
| { | ||
eriqua marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
| "contentVersion": "1.0.0.0", | ||
| "parameters": { | ||
| "name": { | ||
| "value": "<<namePrefix>>-az-nic-x-001" | ||
| }, | ||
| "roleAssignments": { | ||
| "value": [ | ||
| { | ||
| "roleDefinitionIdOrName": "Reader", | ||
| "principalIds": [ | ||
| "<<deploymentSpId>>" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "ipConfigurations": { | ||
| "value": [ | ||
| { | ||
| "name": "ipconfig01", | ||
| "subnetId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-001/subnets/<<namePrefix>>-az-subnet-x-001", | ||
| "loadBalancerBackendAddressPools": [ | ||
| { | ||
| "id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<<namePrefix>>-az-lb-internal-001/backendAddressPools/servers" | ||
| } | ||
| ], | ||
| "applicationSecurityGroups": [ | ||
| { | ||
| "id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<<namePrefix>>-az-asg-x-001" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "diagnosticLogsRetentionInDays": { | ||
| "value": 7 | ||
| }, | ||
| "diagnosticStorageAccountId": { | ||
| "value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<<namePrefix>>azsax001" | ||
| }, | ||
| "diagnosticWorkspaceId": { | ||
| "value": "/subscriptions/<<subscriptionId>>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<<namePrefix>>-az-law-x-001" | ||
| }, | ||
| "diagnosticEventHubAuthorizationRuleId": { | ||
| "value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<<namePrefix>>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" | ||
| }, | ||
| "diagnosticEventHubName": { | ||
| "value": "adp-<<namePrefix>>-az-evh-x-001" | ||
| } | ||
| } | ||
| } | ||
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.