Here authors show that BTNL2 expression on cancer cells generates a dysfunctional tumour immune microenvironment via promoting IL-17A-producing γδ T cells. Here, IL17A is linked to cancer.