Change System Managed Identity

Product: PowerShell Universal
Version: 4.2.2

Hey all,

I had to up the VM size that we were running PSU on in Azure. To do this, I recreated the VM from the disk image.

However, because I’m a noob and forgot about the system managed identity accessing the Azure SQL database, I tried to recreate this but it already existed.

I then tried to delete the old one from the Security in SQL, but it says:

“Drop failed for user SYSTEMMANAGEDID. The database principal owns a schema in the database, and cannot be dropped”

I then added a new user to the database, appending the word “new” on the end, and specified the ObjectID of the System Managed ID and it allowed me to do that. It then started the PSU service.

However, I’m now getting a bunch of messages about HangFire in the logs and a 500 server error returned when trying to get to PSU.

Is there a way I can ditch the existing System Managed IDs from the database and just start a fresh with the same name as it was before?

Cheers,

Daveo

Further to this - I managed to change the owner of the schema to dbo, and delete the old and add the new properly, but now the service starts and just goes into a spamming session of retries on the SQL DB.

Is this a case of ditch the database and re-install PSU?