Hi,
This issue could be caused by a faulty battery or with Windows not recognizing the battery.
Please refer to this article for troubleshooting steps you can try on your Surface device.
If still your device only works when the power supply is plugged in, we suggest that you check the article: How to get service for Surface.
If you're experiencing difficulties filling out the online device repair request form, contact our Answer Desk. If you're outside the US, refer to the Global Customer Service phone numbers.
Feel free to post back if you need assistance.