I have an automated process that's supposed to build out an image and have that image deployed with a user that is setup to run a service. The user needs access to an azure network file share. In order to provide the credentials to access the file share, I save the credentials to Windows Credential Manager via the command below and have it run as my service account.
cmdkey /add:storage.file.core.windows.net /user:Azure\storage /pass:password
Then I add the network map via
net use Z: \\storage.file.core.windows.net\share /persistent:yes
The network is mapped and I am able to access the UNC path above. I then prepare the VM for image capture by running sysprep and generalizing it.
C:\Windows\Sysprep\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm
When I spin up the image again, I am able to log into my service account, but the cmdkey I added has disappeared. I can write a scheduled task to re-add the cmdkey, but was wondering if it really is Sysprep that wipes out my Windows Credentials and if there's a way to avoid it.