Make sure to run the Add-WebConfiguration after the web.config is deployed.
Reasoning: Add-WebConfiguration saves the changes in the web.config file. I assume those changes were immeditaley overwritten by replacing (deploying) the web.config file