Go to Marketing -> Promotions -> Cart Price Rules -> Add New Rule.
Fill in the the rule with the information you want i.e store view and customer group.
Make sure Specific Coupon -> Use Auto Generation is selected.
Fill in the uses per coupon and uses per customer and any conditions you want to add.
Fill in the actions you want the coupon code to do. 10% off etc or fixed price.
Now the next step is to generate the coupon codes. Go to Manage Coupon Codes
Fill in the basic settings that you want.
Coupon Qty = How many Coupons you want to generate
Code Length = Number of Digits/characters in the code
Format = Pick the type you want Alphanumeric should be default
Prefix and Suffix = Optional
Dash Every x Characters = If you want dashes in the code
Then Click Generate
Once your codes are generated you can export them from the export button on the top of the page.
Then Save the promotion