AAD users lose access to database after import

I googled for the last few days but I got a bit confused and I do not know how to proceed further. Also, I’m not a DBA and I was just faced with this situation for the first time. Using sqlpackage.exe I’m exporting a bacpac from a PRD DB and import it on another server to refresh the lower environments. The original database is contained. After I’m importing the new database, the contained database users and the AAD external ones lose access to the new database. I’m fixing the contained database user by updating its password with

ALTER USER [RandomUser] WITH PASSWORD='randomPassword' 

but I am not sure what to do with the AAD users. They have an external user created for them (the aad users are placed inside a group). So far my option is to drop the said user and recreate it

CREATE USER [sthRandom] FROM EXTERNAL PROVIDER 

but in order to do this, you have to be connected with an AAD user

Principal 'sthRandom' could not be created. Only connections established with Active Directory accounts can create other Active Directory users. 

I have to automate this whole process so I could use a service principal like this. I’m creating the service principal inside all the databases, but after refresh the user won’t exist anymore, or I create it in the PRD database too, but I can not use it to login anymore.

What other options do I have? Thanks

If an AI is sure it is going to lose, what can it do to make the game fun for the player?

For context i am contributing to a sequential turn based strategy game. I have an idea how to improve it but i feel i need some input to help me evaluate and improve it. We currently have a really dumb AI that just follows a rough set of rules each turn. I’m considering to upgrade it to a basic search based AI to not be guaranteed to win every time i play it.

There are many reason why an AI could be behind the curve. These include that is wasn’t able to grow it’s economy well due to bad luck with map generation, that it’s economy was disrupted early by an enemy raid while the defending army was out of reach, that the starter army was defeated early and resources had to be invested to replace it instead of economic upgrades or more importantly there being a big awesome deciding battle with all units involved and it lost. A search based AI will be able to know when it is obvious that it is growing slower than it should, can’t recover and it is now impossible to win due to runaway success. Such a runaway success is often boring to play especially if it happened 3 times in a row.

Assume there is no meta game where multiple players can gang up on the strongest one. I am open to nudge the game rules in the AIs favor if this happens. However rubber banding can give the player the impression that they are punished for playing well, the AI drags out a game into an almost stalemate or even wins unfairly.

The problem i’m trying to solve is not that the AI is loosing but that the AI rolling over and dying is not fun or interesting.

It is even worse. If the player is sufficiently good he will experience that every time.

In some theories of literature after the conclusion seems forgone and the tension is falling a new small conflict that is relevant enough or something else that justifies further elaboration and excitement. enter image description here

My idea is to have a library of endgame scenarios, a handful of which end up with player loosing unless he plays really well, most pose a small challenge that the player is entirely able to deal with and some are a "i role over, just kill me already, please".

Are you aware of anyone trying something like this before? If someone tried this in a strategy game or even outside of strategy games before i would like to learn from them.

Can you spot some obvious problems with this idea? I already considered the AI misjudging the impossibility of wining. However i might be to enamored with my idea to spot different problems.

How can i make sure that this still feels fair? It is easy for the AI to get some extra resources however if a player is loosing i am afraid that he would feel cheapened if he got some extra money and units.

How i help the player having fun or at-least variety when they are losing? I really have no ideas for this.

Does a Firbolg lose their invisibility granted by hidden step if their summon makes attacks or deals damage?

Hidden step states:

As a bonus action, you can magically turn invisible until the start of your next turn or until you attack, make a damage roll, or force someone to make a saving throw. Once you use this trait, you can’t use it again until you finish a short or long rest.

My question is that if you summon a creature and command it to attack and deal damage for you, does that count as you making an attack/damage roll and therefore breaking your invisibility? Or does the fact that your summon is it’s own creature mean that you didn’t make any rolls that would break your invisibility (your summon did)?

Does a Swarmkeeper lose their swarm if they die?

In Tasha’s Cauldron of Everything, the Swarmkeeper Ranger’s "Gathered Swarm" feature states the following (emphasis added):

A swarm of intangible nature spirits has bonded itself to you and can assist you in battle. Until you die, the swarm remains in your space […].

In a recent encounter, my Swarmkeeper just died but was resurrected by the party’s Cleric. Because they’ve died, does this mean that the swarm is lost to them forever?

Do you lose your class supernatural abilities when using shapechange?

One of my players is wondering whether you lose the supernatural abilities derived from your class when changing for using shapechange. To me the answer seemed pretty straightforward since the spell says

You gain all extraordinary and supernatural abilities (both attacks and qualities) of the assumed form, but you lose your own supernatural abilities.

But then he found this link

https://forums.giantitp.com/showthread.php?517934-The-3-5-Shapechange-Handbook

And at page 6 it says

enter image description here

But i couldn’t find any source for this claim. I would like to know which version is right and where i can find an official source that clarifies this (unless it’s simply what the spell says and you lose all supernatural abilities)

if you use Enhance Ability: Cat’s Grace on a creature that rolls initiative, does that creature lose the better roll when the spell ends?

Let’s say the caster uses Enhance Ability and chooses Cat’s Grace on themselves and rolls a 13 and a 16 with advantage on initiative, so they take 16. If the caster then loses Enhance Ability in-combat, or ends concentration on that spell, does their initiative roll revert to 13?

If wild shape ends by falling to 0 hp, does the druid lose concentration? [duplicate]

A druid that is wild shaped reverts "when" they drop to 0 hit points. Does that mean other effects that occur when a creature drops to 0 hit points also occur (though possibly in any order of the druid’s choice)? Specifically, if the druid were concentrating on a spell, would dropping to 0 hp – even momentarily – suffice to cause the druid to lose concentration by being incapacitated?

I can’t figure out what RAW or RAI is on this one – does anybody have any pointers (e.g. a rule or rule interaction I missed, or some sage advice)?

Do you lose your prestige class features when you no longer meet its requirements?

Certain prestige classes detail a list of requirements that are possible for the player to lose (alignment, casting at a certain level), but not what happens if you no longer meet those requirements (acting in an opposed way to your alignment, suffereing from energy drain). Some classes and prestige classes do detail what happens if you no longer meet your requirements, but not all do so.

So I am asking: if you no longer meet the requirements of your prestige class by choice or external influences, will you lose the class features gained from it, despite this loss not being detailed in the class itself?

Is it possible to lose HP by levelling up? If it is, is it possible to die by levelling up? [duplicate]

When you level up, you gain a number of Hit Points equal to 1d# (6, 8, 10, or 12) + your Constitution modifier. The lowest Constitution modifier possible is -4 (possible by rolling, and rolling 4 1s). If a PC with a negative Constitution modifier, negative by more than 1, levelled up, and rolled a 1 on the levelling up HP dice, would they lose HP? And, would it be possible to die by this HP loss?

For example, a Wizard with a 3 in Constitution, would have 2 HP at first level. At second level, we’ll say hey rolled a 1 on his Hit Points die. This would mean he gained -3 Hit Points. Would that kill him? I see no rules against this, but it seems to go opposite to the phrase "Levelling Up".