Azure / Azure/arm-template-whatif
Inconsistent IP address validation
- Dominant language
- HTML
- Stars
- 101
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
While the `--what-if` mode did not complain about invalid CIDR, deployment failed with the message: `IpSecurityRestriction.IpAddress is invalid. '123.123.123.123' is an invalid CIDR!`.
**To Reproduce**
Steps to reproduce the behavior:
1. run whatif mode with the following sample
```bicep
resource frontend 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'foo'
kind: 'StorageV2'
location:
sku: {
name: 'Standard_LRS'
}
properties: {
accessTier: 'Cool'
allowBlobPublicAccess: true
networkAcls: {
bypass: 'AzureServices'
ipRules: [
{
value: '123.123.123.123'
action: 'Allow'
}
]
defaultAction: 'Deny'
}
}
}
resource backendWebApp 'Microsoft.Web/sites@2022-03-01' = {
name: 'bar'
kind: 'app,linux'
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
httpsOnly: true
serverFarmId: applicationServicePlan.id
clientAffinityEnabled: true
reserved: true
siteConfig: {
alwaysOn: true
http20Enabled: true
linuxFxVersion: 'PYTHON|3.10'
ipSecurityRestrictions: [
{
// documentation claims i can use a plain IP here, but that seems not to be the case.
ipAddress: '123.123.123.123'
action: 'Allow'
priority: 100
name: 'Some rule'
}
]
}
}
```
=> no error reported
2. Try the same as a real deployment => fails with `invalid CIDR`
**Expected behavior**
What if mode should report the same `invalid CIDR` error. Or alternatively, the deployment should autoconvert the plain IP Address into the desired format. Alternatively correct the documentation.
**Client** [e.g. PowerShell, CLI, API)
CLI
**Additional context**
- In the Azure UI I can provide "simple IP" addresses, they then get autoconverted to CIDR. Would be nice if this works here as well.
- That would also be more consistent with the ACL config for storage where plain IP addresses are also allowed
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the supplied Bicep sample in what-if mode and as a real deployment, focusing on the storage and web app IP validation paths. Confirm whether what-if should report the same invalid CIDR error; done means consistent behavior or corrected documentation for plain IP addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100