Skip to content
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
3 changes: 1 addition & 2 deletions .github/workflows/ms.network.publicipaddresses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ jobs:
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@description('Optional. The location to deploy to.')
param location string = resourceGroup().location

@description('Required. The name of the Managed Identity to create.')
param managedIdentityName string

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: managedIdentityName
location: location
}

@description('The principal ID of the created Managed Identity.')
output managedIdentityPrincipalId string = managedIdentity.properties.principalId

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.network.publicipaddresses-${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 = 'npiacom'

// =========== //
// 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: {
managedIdentityName: 'dep-<<namePrefix>>-msi-${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'
diagnosticLogsRetentionInDays: 7
diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId
diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
lock: 'CanNotDelete'
publicIPAllocationMethod: 'Static'
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
skuName: 'Standard'
zones: [
'1'
'2'
'3'
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.network.publicipaddresses-${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 = 'npiamin'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'
}
}

This file was deleted.

10 changes: 4 additions & 6 deletions modules/Microsoft.Network/publicIPAddresses/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: {
}
}]

var publicIPPrefix = {
id: publicIPPrefixResourceId
}

resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
name: 'pid-47ed15a6-730a-4827-bcb4-0fd963ffbd82-${uniqueString(deployment().name, location)}'
properties: {
Expand All @@ -142,7 +138,9 @@ resource publicIpAddress 'Microsoft.Network/publicIPAddresses@2021-08-01' = {
properties: {
publicIPAddressVersion: publicIPAddressVersion
publicIPAllocationMethod: publicIPAllocationMethod
publicIPPrefix: !empty(publicIPPrefixResourceId) ? publicIPPrefix : null
publicIPPrefix: !empty(publicIPPrefixResourceId) ? {
id: publicIPPrefixResourceId
} : null
idleTimeoutInMinutes: 4
ipTags: []
}
Expand Down Expand Up @@ -193,7 +191,7 @@ output name string = publicIpAddress.name
output resourceId string = publicIpAddress.id

@description('The public IP address of the public IP address resource.')
output ipAddress string = publicIpAddress.properties.ipAddress
output ipAddress string = contains(publicIpAddress.properties, 'ipAddress') ? publicIpAddress.properties.ipAddress : ''

@description('The location the resource was deployed into.')
output location string = publicIpAddress.location
65 changes: 51 additions & 14 deletions modules/Microsoft.Network/publicIPAddresses/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,30 +169,30 @@ The following module usage examples are retrieved from the content of the files

>**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order.

<h3>Example 1: Parameters</h3>
<h3>Example 1: Common</h3>

<details>

<summary>via Bicep module</summary>

```bicep
module publicIPAddresses './Microsoft.Network/publicIPAddresses/deploy.bicep' = {
name: '${uniqueString(deployment().name)}-PublicIPAddresses'
name: '${uniqueString(deployment().name)}-test-npiacom'
params: {
// Required parameters
name: '<<namePrefix>>-az-pip-x-001'
name: '<<namePrefix>>npiacom001'
// Non-required parameters
diagnosticEventHubAuthorizationRuleId: '/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<<namePrefix>>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey'
diagnosticEventHubName: 'adp-<<namePrefix>>-az-evh-x-001'
diagnosticEventHubAuthorizationRuleId: '<diagnosticEventHubAuthorizationRuleId>'
diagnosticEventHubName: '<diagnosticEventHubName>'
diagnosticLogsRetentionInDays: 7
diagnosticStorageAccountId: '/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<<namePrefix>>azsax001'
diagnosticWorkspaceId: '/subscriptions/<<subscriptionId>>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<<namePrefix>>-az-law-x-001'
diagnosticStorageAccountId: '<diagnosticStorageAccountId>'
diagnosticWorkspaceId: '<diagnosticWorkspaceId>'
lock: 'CanNotDelete'
publicIPAllocationMethod: 'Static'
roleAssignments: [
{
principalIds: [
'<<deploymentSpId>>'
'<managedIdentityPrincipalId>'
]
roleDefinitionIdOrName: 'Reader'
}
Expand Down Expand Up @@ -221,23 +221,23 @@ module publicIPAddresses './Microsoft.Network/publicIPAddresses/deploy.bicep' =
"parameters": {
// Required parameters
"name": {
"value": "<<namePrefix>>-az-pip-x-001"
"value": "<<namePrefix>>npiacom001"
},
// Non-required parameters
"diagnosticEventHubAuthorizationRuleId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<<namePrefix>>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey"
"value": "<diagnosticEventHubAuthorizationRuleId>"
},
"diagnosticEventHubName": {
"value": "adp-<<namePrefix>>-az-evh-x-001"
"value": "<diagnosticEventHubName>"
},
"diagnosticLogsRetentionInDays": {
"value": 7
},
"diagnosticStorageAccountId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<<namePrefix>>azsax001"
"value": "<diagnosticStorageAccountId>"
},
"diagnosticWorkspaceId": {
"value": "/subscriptions/<<subscriptionId>>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<<namePrefix>>-az-law-x-001"
"value": "<diagnosticWorkspaceId>"
},
"lock": {
"value": "CanNotDelete"
Expand All @@ -249,7 +249,7 @@ module publicIPAddresses './Microsoft.Network/publicIPAddresses/deploy.bicep' =
"value": [
{
"principalIds": [
"<<deploymentSpId>>"
"<managedIdentityPrincipalId>"
],
"roleDefinitionIdOrName": "Reader"
}
Expand All @@ -271,3 +271,40 @@ module publicIPAddresses './Microsoft.Network/publicIPAddresses/deploy.bicep' =

</details>
<p>

<h3>Example 2: Min</h3>

<details>

<summary>via Bicep module</summary>

```bicep
module publicIPAddresses './Microsoft.Network/publicIPAddresses/deploy.bicep' = {
name: '${uniqueString(deployment().name)}-test-npiamin'
params: {
name: '<<namePrefix>>npiamin001'
}
}
```

</details>
<p>

<details>

<summary>via JSON Parameter file</summary>

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>npiamin001"
}
}
}
```

</details>
<p>