If you have a non-Steam version of XCOM 2, you'll have to right click your primary xcom2.exe, go to the Properties tab, and paste "-allowconsole" into the target field box.
For Steam versions, right click on XCOM 2 in your games library, open the general properties tab, and then paste "-allowconsole" in the set launch options box.
Press the console key ` (above the Enter key) in-game and type “enablecheats” to enable the developer cheats.
Cheat Code Effect
PowerUp - All units made invincible, with unlimited ammo
TakeNoDamage - All units made invincible
LightPlatedArmor # - x number of Spider suit's
MediumPlatedArmor # - x number of Predator armor
HeavyPlatedArmor # - x number of E.X.O. suit's
LightPoweredArmor # - x number of Wraith suit's
MediumPoweredArmor # - x number of Warden armor
HeavyPoweredArmor # - x number of W.A.R. suit's
ReloadUpgrade # - Gives X amount of Auto Loaders
AimUpgrade # - Gives X amount of Scopes
ClipSizeUpgrade # - Gives X amount of Extended Mags
CritUpgrade # - Gives X amount of Laser Sights
FreeKillUpgrade # - Gives X amount of Repeaters
FreeFireUpgrade # - Gives X amount of Hair Triggers
MissDamageUpgrade # - Gives X amount of Stocks
giveresource CorpseAdventTrooper # - Gives x number of corpses
giveresource CorpseAdventMEC # - Gives x number of corpses
giveresource CorpseAdventOfficer # - Gives x number of corpses
giveresource CorpseSectoid # - Gives x number of corpses
giveresource Intel # - Gives x amount of Intel
giveresource EleriumCore # - Gives x number of elerium Cores
AddItem BattleScanner # - x number of BattleScanners
AddItem Mind Shield # - x number of Mind Shields
AddItem HazmatVest # - x number of Hazmat Vests
AddItem Stasis Vest # - x number of Stasis Vests
GiveScientist # - x number of Stasis Vests.
GiveEngineer # - x number of Stasis Vests
MakeSoldierAClass "X" Specialist - Makes named soldier named class
SkipAI - Skips AI turns
ToggleUnlimitedActions - Allows for unlimited actions. (Beware AI can use this too)
ForceCritHits - All hits will be criticals (Beware AI can use this too)
Togglefow - Makes entire map visible(You will still need to "discover" enemies)
ToggleSquadConcealment - Forces squad into concealment(AI will still be alerted)
RestartLevel - Restarts the current mission
HealAllSoldiers - Heals all soldiers while in the Avenger(does not work during mission)
LevelUpBarracks # - Levels up all soldiers in Avenger Barracks by X levels.