Exhibit 23.1

| Ernst & Young LLP 2200, 215 2nd St SW Calgary, AB T2P 1M4 | Tel: +1 403 206 5000 Fax: +1 403 290 4265 ey.com/ca |
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We consent to the use of our reports dated March 1, 2018 with respect to the consolidated financial statements of TransAlta Corporation as at December 31, 2017 and 2016 and for each of the years in the three year period ended December 31, 2017, and internal control over financial reporting as of December 31, 2017 of TransAlta Corporation, included as an exhibit to or incorporated by reference in the Annual Report (Form 40-F) for 2017.
We also consent to the incorporation by reference in the following Registration Statements:
(1) Registration Statement (Form S-8 No. 333-72454 and No. 333-101470) pertaining to TransAlta Corporation’s Share Option Plan
(2) Registration Statement (Form F-10 No. 333-215608) pertaining to the registration of Debt and Equity Securities of TransAlta Corporation
of our reports dated March 1, 2018, with respect to the consolidated financial statements of TransAlta Corporation as at December 31, 2017 and 2016 and for each of the years in the three year period ended December 31, 2017, and internal control over financial reporting as of December 31, 2017 of TransAlta Corporation, included as an exhibit to or incorporated by reference in the Annual Report (Form 40-F) of TransAlta Corporation for the year ended December 31, 2017.
| /s/Ernst & Young LLP |
Calgary, Alberta | Chartered Professional Accountants |
March 1, 2018 | |
A member firm of Ernst & Young Global Limited