MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.48k forks source link

mysql flexible creation using Bicep {"code":"InvalidParameterValue","message":"Invalid value given for parameter administratorName. Specify a valid parameter value."} #124887

Open Kosaln opened 3 days ago

Kosaln commented 3 days ago

Hi Guys, Im getting this issue for mysql server creation with bicep latest api. I'm giving the administrator name as user assigned managed Identity name {"code":"InvalidParameterValue","message":"Invalid value given for parameter administratorName. Specify a valid parameter value."}. Im able to do the same on portal. Pls help.

resource server 'Microsoft.DBforMySQL/flexibleServers@2024-06-01-preview' = { location: location name: serverName sku: { name: skuName tier: serverEdition } identity: { type: 'UserAssigned' userAssignedIdentities: { '${userAssignedIdentityResourceId}': {} //any() } } properties: { version: serverVersion administratorLogin: administratorLogin administratorLoginPassword: administratorLoginPassword availabilityZone: '1' highAvailability: { mode: haEnabled } } }

resource userManagedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { scope:resourceGroup(umirgname) name: umiName }

resource mysqlEntraAdmin 'Microsoft.DBforMySQL/flexibleServers/administrators@2023-12-30' = { name: '${serverName}-AADlogin' parent: server properties: { administratorType: 'ActiveDirectory' identityResourceId: userAssignedIdentityResourceId sid: userManagedIdentity.properties.principalId tenantId: userManagedIdentity.properties.tenantId login: umiName }

}

TPavanBalaji commented 2 days ago

@Kosaln It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!

Kosaln commented 2 days ago

here you go https://learn.microsoft.com/en-us/azure/templates/microsoft.dbformysql/flexibleservers/administrators?pivots=deployment-language-bicep

TPavanBalaji commented 1 day ago

Using an Active Directory administrator conflicts with the administratorLogin and administratorLoginPassword columns in your Bicep deployment, which are necessary for the construction of a MySQL Flexible Server. Both an Active Directory administrator and a conventional MySQL administrator cannot be specified simultaneously. To fix the issue, you can update your Bicep file to only use Active Directory for administration by omitting administratorLogin and administratorLoginPassword when using the Active Directory administrator.

Kosaln commented 1 day ago

But, if i chose to use mysql and aad authentication then its a challenge. How do we go about it.?

TPavanBalaji commented 1 day ago

Please refer to this article, I hope it might help for your requirements.

Kosaln commented 23 hours ago

I'm trying to achieve this through bicep not from the portal. this wont help. Will there be any development to mysql bicep module, wherein it allow to set the authentication type and enter the entra ids for authentication, Just like we have for postgres flexible