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

Improve decompiler naming of resources: remove trailing "Name" from resources #8500

Merged
merged 9 commits into from
Sep 29, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ param storageAccountType string = 'Standard_LRS'
@description('Location for all resources.')
param location string = resourceGroup().location

var virtualMachineName_var = 'VM-MultiNic'
var virtualMachineName = 'VM-MultiNic'
var nic1_var = 'nic-1'
var nic2_var = 'nic-2'
var virtualNetworkName_var = 'virtualNetwork'
var virtualNetworkName = 'virtualNetwork'
var subnet1Name = 'subnet-1'
var subnet2Name = 'subnet-2'
var publicIPAddressName_var = 'publicIp'
var subnet1Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName_var, subnet1Name)
var subnet2Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName_var, subnet2Name)
var diagStorageAccountName_var = 'diags${uniqueString(resourceGroup().id)}'
var networkSecurityGroupName_var = 'NSG'
var networkSecurityGroupName2_var = '${subnet2Name}-nsg'
var publicIPAddressName = 'publicIp'
var subnet1Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnet1Name)
var subnet2Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnet2Name)
var diagStorageAccountName = 'diags${uniqueString(resourceGroup().id)}'
var networkSecurityGroupName = 'NSG'
var networkSecurityGroupName2 = '${subnet2Name}-nsg'

resource virtualMachineName 'Microsoft.Compute/virtualMachines@2019-12-01' = {
name: virtualMachineName_var
resource virtualMachine 'Microsoft.Compute/virtualMachines@2019-12-01' = {
StephenWeatherford marked this conversation as resolved.
Show resolved Hide resolved
name: virtualMachineName
location: location
properties: {
osProfile: {
computerName: virtualMachineName_var
computerName: virtualMachineName
adminUsername: adminUsername
adminPassword: adminPassword
windowsConfiguration: {
Expand Down Expand Up @@ -77,28 +77,28 @@ resource virtualMachineName 'Microsoft.Compute/virtualMachines@2019-12-01' = {
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
storageUri: reference(diagStorageAccountName.id, '2019-06-01').primaryEndpoints.blob
storageUri: reference(diagStorageAccount.id, '2019-06-01').primaryEndpoints.blob
}
}
}
}

resource diagStorageAccountName 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: diagStorageAccountName_var
resource diagStorageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: diagStorageAccountName
location: location
sku: {
name: storageAccountType
}
kind: 'StorageV2'
}

resource networkSecurityGroupName2 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName2_var
resource networkSecurityGroup2 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName2
location: location
}

resource virtualNetworkName 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: virtualNetworkName_var
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
Expand Down Expand Up @@ -138,7 +138,7 @@ resource virtualNetworkName 'Microsoft.Network/virtualNetworks@2020-05-01' = {
properties: {
addressPrefix: '10.0.1.0/24'
networkSecurityGroup: {
id: networkSecurityGroupName2.id
id: networkSecurityGroup2.id
}
}
}
Expand All @@ -159,18 +159,18 @@ resource nic1 'Microsoft.Network/networkInterfaces@2020-05-01' = {
}
privateIPAllocationMethod: 'Dynamic'
publicIPAddress: {
id: publicIpAddressName.id
id: publicIpAddress.id
}
}
}
]
networkSecurityGroup: {
id: networkSecurityGroupName.id
id: networkSecurityGroup.id
}
}
dependsOn: [

virtualNetworkName
virtualNetwork
]
}

Expand All @@ -191,20 +191,20 @@ resource nic2 'Microsoft.Network/networkInterfaces@2020-05-01' = {
]
}
dependsOn: [
virtualNetworkName
virtualNetwork
]
}

resource publicIpAddressName 'Microsoft.Network/publicIPAddresses@2020-05-01' = {
name: publicIPAddressName_var
resource publicIpAddress 'Microsoft.Network/publicIPAddresses@2020-05-01' = {
name: publicIPAddressName
location: location
properties: {
publicIPAllocationMethod: 'Dynamic'
}
}

resource networkSecurityGroupName 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName_var
resource networkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName
location: location
properties: {
securityRules: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ param keyName string
@description('The Azure Key Vault encryption key version.')
param keyVersion string

resource dataLakeStoreName_resource 'Microsoft.DataLakeStore/accounts@2016-11-01' = {
resource dataLakeStore 'Microsoft.DataLakeStore/accounts@2016-11-01' = {
name: dataLakeStoreName
location: location
properties: {
Expand All @@ -39,7 +39,7 @@ module addAccessPolicy './nested_addAccessPolicy.bicep' = {
name: 'addAccessPolicy'
scope: resourceGroup(keyVaultResourceGroupName)
params: {
resourceId_Microsoft_DataLakeStore_accounts_parameters_dataLakeStoreName: reference(dataLakeStoreName_resource.id, '2016-11-01', 'Full')
resourceId_Microsoft_DataLakeStore_accounts_parameters_dataLakeStoreName: reference(dataLakeStore.id, '2016-11-01', 'Full')
keyVaultName: keyVaultName
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param keyName string
@description('The Azure Key Vault encryption key version.')
param keyVersion string

resource dataLakeStoreName_resource 'Microsoft.DataLakeStore/accounts@2016-11-01' = {
resource dataLakeStore 'Microsoft.DataLakeStore/accounts@2016-11-01' = {
name: dataLakeStoreName
location: location
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ param adminPasswordOrKey string
@description('description')
param vmSize string = 'Standard_A1_v2'

var virtualNetworkName_var = 'VNET'
var virtualNetworkName = 'VNET'
var addressPrefix = '10.0.0.0/16'
var subnet1Name = 'Subnet-1'
var subnet2Name = 'Subnet-2'
var subnet1Prefix = '10.0.0.0/24'
var subnet2Prefix = '10.0.1.0/24'
var subnet1Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName_var, subnet1Name)
var subnet2Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName_var, subnet2Name)
var subnet1Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnet1Name)
var subnet2Ref = resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnet2Name)
var availabilitySetName_var = 'AvSet'
var imageReference = {
Ubuntu: {
Expand All @@ -53,7 +53,7 @@ var imageReference = {
version: 'latest'
}
}
var networkSecurityGroupName_var = 'default-NSG'
var networkSecurityGroupName = 'default-NSG'
var nsgOsPort = {
Ubuntu: '22'
Windows: '3389'
Expand Down Expand Up @@ -82,8 +82,8 @@ resource availabilitySetName 'Microsoft.Compute/availabilitySets@2020-06-01' = [
}
}]

resource networkSecurityGroupName 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName_var
resource networkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2020-05-01' = {
name: networkSecurityGroupName
location: location
properties: {
securityRules: [
Expand All @@ -104,8 +104,8 @@ resource networkSecurityGroupName 'Microsoft.Network/networkSecurityGroups@2020-
}
}

resource virtualNetworkName 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: virtualNetworkName_var
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
Expand All @@ -119,7 +119,7 @@ resource virtualNetworkName 'Microsoft.Network/virtualNetworks@2020-05-01' = {
properties: {
addressPrefix: subnet1Prefix
networkSecurityGroup: {
id: networkSecurityGroupName.id
id: networkSecurityGroup.id
}
}
}
Expand All @@ -128,7 +128,7 @@ resource virtualNetworkName 'Microsoft.Network/virtualNetworks@2020-05-01' = {
properties: {
addressPrefix: subnet2Prefix
networkSecurityGroup: {
id: networkSecurityGroupName.id
id: networkSecurityGroup.id
}
}
}
Expand All @@ -153,7 +153,7 @@ resource nic 'Microsoft.Network/networkInterfaces@2020-05-01' = [for i in range(
]
}
dependsOn: [
virtualNetworkName
virtualNetwork
]
}]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ param RetentionDays int
param FlowLogsversion string
param storageAccountResourceId string

resource NetworkWatcherName_FlowLogName 'Microsoft.Network/networkWatchers/flowLogs@2020-06-01' = if ((1 + 2) == 3) {
resource NetworkWatcherName_FlowLog 'Microsoft.Network/networkWatchers/flowLogs@2020-06-01' = if ((1 + 2) == 3) {
name: '${NetworkWatcherName}/${FlowLogName}'
location: location
properties: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
param hostingPlanName string
param location string = resourceGroup().location

var siteName_var = 'ExampleSite${uniqueString(resourceGroup().id)}'
var siteName = 'ExampleSite${uniqueString(resourceGroup().id)}'

resource hostingPlanName_resource 'Microsoft.Web/serverfarms@2020-06-01' = {
resource hostingPlan 'Microsoft.Web/serverfarms@2020-06-01' = {
name: hostingPlanName
location: location
sku: {
Expand All @@ -16,19 +16,19 @@ resource hostingPlanName_resource 'Microsoft.Web/serverfarms@2020-06-01' = {
}
}

resource siteName 'Microsoft.Web/sites@2020-06-01' = {
name: siteName_var
resource site 'Microsoft.Web/sites@2020-06-01' = {
name: siteName
location: location
properties: {
serverFarmId: hostingPlanName
}
dependsOn: [
hostingPlanName_resource
hostingPlan
]
}

resource siteLock 'Microsoft.Authorization/locks@2016-09-01' = {
scope: siteName
scope: site
name: 'siteLock'
properties: {
level: 'CanNotDelete'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var automationModules = {
]
}

resource automationAccountName_automationModules_modules_Name 'Microsoft.Automation/automationAccounts/modules@2015-10-31' = [for i in range(0, length(automationModules.modules)): if (deployAutomationModules == 'true') {
resource automationAccountName_automationModules_modules 'Microsoft.Automation/automationAccounts/modules@2015-10-31' = [for i in range(0, length(automationModules.modules)): if (deployAutomationModules == 'true') {
name: '${automationAccountName}/${automationModules.modules[i].Name}'
location: location
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@ param sftpPassword string
@description('Primary location for resources')
param location string = resourceGroup().location

var scriptName_var = 'createFileShare'
var identityName_var = 'scratch'
var scriptName = 'createFileShare'
var identityName = 'scratch'
var roleDefinitionId = resourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
var roleDefinitionName_var = guid(identityName_var, roleDefinitionId)
var roleDefinitionName = guid(identityName, roleDefinitionId)
var sftpContainerName = 'sftp'
var sftpContainerGroupName_var = 'sftp-group'
var sftpContainerGroupName = 'sftp-group'
var sftpContainerImage = 'atmoz/sftp:latest'
var sftpEnvVariable = '${sftpUser}:${sftpPassword}:1001'
var storageAccountName_var = 'sftpstg${uniqueString(resourceGroup().id)}'
var storageAccountName = 'sftpstg${uniqueString(resourceGroup().id)}'

resource identityName 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: identityName_var
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: identityName
location: location
}

resource roleDefinitionName 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: roleDefinitionName_var
resource roleDefinition 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: roleDefinitionName
properties: {
roleDefinitionId: roleDefinitionId
principalId: identityName.properties.principalId
principalId: identity.properties.principalId
scope: resourceGroup().id
//@[4:9) [BCP073 (Warning)] The property "scope" is read-only. Expressions cannot be assigned to read-only properties. If this is an inaccuracy in the documentation, please report it to the Bicep Team. (CodeDescription: bicep(https://aka.ms/bicep-type-issues)) |scope|
principalType: 'ServicePrincipal'
}
}

resource storageAccountName 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName_var
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName
location: location
sku: {
name: storageAccountType
Expand All @@ -54,37 +54,37 @@ resource storageAccountName 'Microsoft.Storage/storageAccounts@2019-06-01' = {
properties: {
}
dependsOn: [
roleDefinitionName
roleDefinition
]
}

resource scriptName 'Microsoft.Resources/deploymentScripts@2019-10-01-preview' = {
name: scriptName_var
resource script 'Microsoft.Resources/deploymentScripts@2019-10-01-preview' = {
name: scriptName
location: location
kind: 'AzurePowerShell'
identity: {
type: 'userAssigned'
userAssignedIdentities: {
'${identityName.id}': {
'${identity.id}': {
}
}
}
properties: {
forceUpdateTag: '1'
azPowerShellVersion: '3.0'
arguments: ' -storageAccountName ${storageAccountName_var} -fileShareName ${fileShareName} -resourceGroupName ${resourceGroup().name}'
arguments: ' -storageAccountName ${storageAccountName} -fileShareName ${fileShareName} -resourceGroupName ${resourceGroup().name}'
scriptContent: '\n param(\n [string] $storageAccountName,\n [string] $fileShareName,\n [string] $resourceGroupName\n )\n Get-AzStorageAccount -StorageAccountName $storageAccountName -ResourceGroupName $resourceGroupName | New-AzStorageShare -Name $fileShareName\n '
timeout: 'PT5M'
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
}
dependsOn: [
storageAccountName
storageAccount
]
}

resource sftpContainerGroupName 'Microsoft.ContainerInstance/containerGroups@2019-12-01' = {
name: sftpContainerGroupName_var
resource sftpContainerGroup 'Microsoft.ContainerInstance/containerGroups@2019-12-01' = {
name: sftpContainerGroupName
location: location
properties: {
containers: [
Expand Down Expand Up @@ -136,15 +136,15 @@ resource sftpContainerGroupName 'Microsoft.ContainerInstance/containerGroups@201
azureFile: {
readOnly: false
shareName: fileShareName
storageAccountName: storageAccountName_var
storageAccountKey: listKeys(storageAccountName_var, '2018-02-01').keys[0].value
storageAccountName: storageAccountName
storageAccountKey: listKeys(storageAccountName, '2018-02-01').keys[0].value
}
}
]
}
dependsOn: [
scriptName
script
]
}

output containerIPv4Address string = sftpContainerGroupName.properties.ipAddress.ip
output containerIPv4Address string = sftpContainerGroup.properties.ipAddress.ip
Loading