ResourceModules icon indicating copy to clipboard operation
ResourceModules copied to clipboard

[Bug Report]: Azure Sql Database deployment breaks when Db name is longer than 25 characters

Open zydio opened this issue 3 years ago • 2 comments

Describe the bug

Since the addition of backupShortTermRetentionPolicies and backupLongTermRetentionPolicies in Sql Database module in PR https://github.com/Azure/ResourceModules/pull/2802, a deployment will fail if the Sql Database name is longer than 25 characters because the resulting module name would exceed the maximum allowed one (64 chars).

A potential fix would be adding a take() function as to shorten the name when building the module name:

  • from '${uniqueString(deployment().name, location)}-${name}-shortTermBackupRetention' to '${uniqueString(deployment().name, location)}-${take(name,25)}-shortTermBackupRetention'
  • from name: '${uniqueString(deployment().name, location)}-${name}-longTermBackupRetention' to name: '${uniqueString(deployment().name, location)}-${take(name,26)}-longTermBackupRetention'

To reproduce

Deploy a Sql Database whose name is longer than 25 characters, with any set of parameters. The deployment will fail

Code snippet

No response

Relevant log output

the provided deployment name '[.......]' has a length of '65' which exceeds the maximum length of '64'. Please see https://aka.ms/arm-deploy for usage details.

zydio avatar Jul 25 '23 16:07 zydio