Software security is not security software. Here we're concerned with topics like authentication, access control, confidentiality, cryptography, and privilege management.
<transportSender>
tag should not specify http
, because communication with this URL will not be encrypted.public_access
parameter set to container
. This allows anonymous access to all of the Container's blobs and data.
- name: Create container test
azure_rm_storageblob:
resource_group: testGroup
storage_account_name: sa001
container: testContainer
...
public_access: container
...
- name: testFWRule
azure_rm_securitygroup:
resource_group: testRG
name: test
rules:
- name: rule001
priority: 100
direction: Inbound
access: Allow
protocol: "*"
source_port_range: "*"
destination_port_range: "3388-3398"
source_address_prefix: "*"
destination_address_prefix: "*"
- name: rule002
priority: 100
direction: Inbound
access: Allow
protocol: "*"
source_port_range: "*"
destination_port_range: 22
source_address_prefix: "*"
destination_address_prefix: "*"
- name: storage with network acl
azure_rm_storageaccount:
resource_group: testGroup
name: sa001
type: Standard_RAGRS
network_acls:
bypass: AzureServices,Metrics
default_action: Deny
ip_rules:
- value: 0.0.0.0/0
action: Allow
- name: Create MySQL Server
azure.azcollection.azure_rm_mysqlserver:
resource_group: testGroup
name: testMySQL
sku:
name: B_Gen5_1
tier: Basic
location: westeurope
storage_mb: 8096
version: 5.6
enforce_ssl: false
admin_username: test
admin_password: complicatedPass
- name: Create Postgres Server
azure.azcollection.azure_rm_postgresqlserver:
resource_group: testGroup
name: testPostgres
sku:
name: B_Gen5_1
tier: Basic
location: westeurope
storage_mb: 8096
version: 5.6
enforce_ssl: false
admin_username: test
admin_password: complicatedPass
https_only
setting is set to yes
enforcing secure transfer for an Azure storage account. However, this setting can be explicitly disabled.
- name: create a storage account
azure_rm_storageaccount:
resource_group: testResGroup
name: sa0001
type: Standard_GRS
https_only: no
- name: AKS Instance
azure_rm_aks:
name:
resource_group: testResourceGroup
location: eastus
...
addon:
monitoring:
log_analytics_workspace_resource_id: logws001
enabled: no
@secure()
decorator.@secure()
decorator, the parameter values are not logged or stored in the deployment history.
@secure()
param rootPassword string = 'HardcodedPassword'
param adminLogin string
param sqlServerName string
...
securestring
or secureobject
types.
{
...
"parameters": {
"rootPassword": {
"defaultValue": "HardcodedPassword",
"type": "secureString"
},
"adminLogin": {
"type": "string"
},
"sqlServerName": {
"type": "string"
}
},
...
}
"supportsHttpsTrafficOnly": "false"
param location string = resourceGroup().location
resource example 'Microsoft.ContainerService/managedClusters@2020-02-01' = {
name: 'TestCluster'
location: location
properties: {
...
servicePrincipalProfile: {
clientId: '422313d8-123a-41ea-8f8e-90821ff61c05'
secret: 'xxxxxxxxxxxxxxxxx'
}
}
}
{
"name": "TestCluster",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2020-02-01",
"location": "[resourceGroup().location]",
"properties": {
...
"servicePrincipalProfile": {
"clientId": "422313d8-123a-41ea-8f8e-90821ff61c05",
"secret": "xxxxxxxxxxxxxxxxx"
},
}
}
resource example 'Microsoft.Web/sites/config@2022-09-01' = {
...
properties: {
...
remoteDebuggingEnabled: true
}
}
{
...
"type": "Microsoft.Web/sites/config",
"properties":
{
...
"remoteDebuggingEnabled": true,
}
}
publicAccess
property set to Container
. This allows anonymous access to all of the container's blobs and data.
param storageAccountName string
param containerName string
resource example 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-04-01' = {
name: '${storageAccountName}/default/${containerName}'
...
properties: {
...
publicAccess: 'Container'
}
}
publicAccess
property set to Container
. This allows anonymous access to all of the Container's blobs and data.
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2021-04-01",
"name": "[format('{0}/default/{1}', parameters('storageAccountName'), parameters('containerName'))]",
"properties":{
"publicAccess": "Container"
}
,
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
]
}
publicNetworkAccess
and making no IP restrictions.Example 2: The following example template defines an Azure Container Registry with unrestricted network access by specifying a broad allow list for the
resource example 'Microsoft.ContainerRegistry/registries@2022-12-01' = {
...
properties: {
...
publicNetworkAccess: 'Enabled'
}
}
networkRuleSet
property.
resource example 'Microsoft.ContainerRegistry/registries@2022-12-01' = {
...
properties: {
...
publicNetworkAccess: 'Enabled'
networkRuleSet: {
defaultAction: 'Allow'
ipRules: [
{
action: 'Allow'
value: '*'
}
]
}
}
}
publicNetworkAccess
and making no IP restrictions.Example 2: The following example template defines an Azure Container Registry with unrestricted network access by specifying a broad allow list for the
{
"name": "[variables('acrName')]",
"type": "Microsoft.ContainerRegistry/registries",
...
"properties": {
"publicNetworkAccess": "Enabled",
..
}
networkRuleSet
property.
{
"name": "[variables('acrName')]",
"type": "Microsoft.ContainerRegistry/registries",
...
"properties": {
"publicNetworkAccess": "Enabled",
"networkRuleSet":
{
"defaultAction": "Allow",
"ipRules":[{
"action": "Allow",
"value": "*"
}]
}
...
}
Example 2: The following example template defines an overly permissive CORS policy for an Azure web application.
resource example 'Microsoft.SignalRService/SignalR@2022-02-01' = {
...
properties: {
...
cors: {
...
allowedOrigins: [ '*' ]
}
}
}
Example 3: The following example template defines an overly permissive CORS policy for an Azure Maps account.
resource example 'Microsoft.Web/sites@2020-12-01' = {
...
properties: {
...
siteConfig: {
...
cors: {
...
allowedOrigins: [ '*' ]
}
}
}
}
Example 4: The following example template defines an overly permissive CORS policy for an Azure Cosmos DB account.
resource example 'Microsoft.Maps/accounts@2021-12-01-preview' = {
...
properties: {
...
cors: {
corsRules: [
{
allowedOrigins: [ '*' ]
}
]
}
}
}
Example 5: The following example template defines an overly permissive CORS policy for an Azure storage blob service.
resource example 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = {
...
properties: {
...
cors: [
{
...
allowedOrigins: '*'
}
]
}
}
resource example 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = {
...
properties: {
...
cors: {
corsRules: [
{
...
allowedOrigins: [ '*' ]
}
]
}
}
}
Example 2: The following example template defines an overly permissive CORS policy for an Azure web application.
{
...
"type": "Microsoft.SignalRService/SignalR",
...
"properties": {
...
"cors": {
"allowedOrigins": ["*"]
},
...
}
Example 3: The following example template defines an overly permissive CORS policy for an Azure Maps account.
{
"apiVersion": "2020-12-01",
"type": "Microsoft.Web/sites",
...
"properties": {
...
"siteConfig": {
...
"cors": {
"allowedOrigins": [
"*"
]
},
...
}
Example 4: The following example template defines an overly permissive CORS policy for an Azure Cosmos DB account.
{
"apiVersion": "2021-12-01-preview",
"type": "Microsoft.Maps/accounts",
...
"properties":{
"cors":{
"allowedOrigins": ["*"]
}
},
...
}
Example 5: The following example template defines an overly permissive CORS policy for an Azure storage blob service.
{
"type": "Microsoft.DocumentDB/databaseAccounts",
...
"properties": {
"cors": [{
"allowedOrigins":"*"
}],
...
}
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
...
"properties": {
"cors": {
"corsRules": [
{
"allowedOrigins":["*"],
...
}
]
}
}
...
}
publicNetworkAccess
property is set to Enabled
and the IP address range includes all IPs.
resource example 'Microsoft.DocumentDB/databaseAccounts@2021-04-15' = {
...
properties: {
...
publicNetworkAccess: 'Enabled'
ipRules: [
{
ipAddressOrRange: '0.0.0.0'
}
]
}
}
publicNetworkAccess
property is set to Enabled
and the IP address range includes all IPs.
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"apiVersion": "2021-04-15",
...
"properties": {
...
"publicNetworkAccess": "Enabled",
"ipRules":[{
"ipAddressOrRange": "0.0.0.0"
}]
...
}
resource example 'Microsoft.Network/networkSecurityGroups/securityRules@2020-11-01' = {
...
properties: {
...
description: 'Services Inbound Range'
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRanges: [ '3333-3389' ]
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
access: 'Allow'
priority: 100
direction: 'Inbound'
}
}
{
...
"name": "sample/securitygroup",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"apiVersion": "2020-11-01",
"properties": {
"description": "Services Inbound Range",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRanges": [
"3333-3389"
],
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
...
}
resource example 'Microsoft.Sql/servers@2021-11-01' = {
...
resource fwRules 'firewallRules' = {
properties: {
startIpAddress: '0.0.0.0'
endIpAddress: '255.255.255.255'
}
}
}
{
"resources": [
{
"name": "[variables('sqlServerName')]",
"type": "Microsoft.Sql/servers",
...
"resources": [
{
"type": "databases",
...
},
{
"name": "AllowAllIPs",
"type": "firewallrules",
"apiVersion": "2020-02-02-preview",
"location": "[parameters('location')]",
"properties": {
"endIpAddress": "255.255.255.255",
"startIpAddress": "0.0.0.0"
},
}
]
}
]
}