With a grant of immunity from possible prosecution, a senior adviser to Boston Mayor Marty Walsh testified Wednesday in the ongoing trial of two members of the Walsh administration accused of extortion.

Joyce Linehan, one of Walsh’s first high-level hires and who has served as an advisor to the mayor since he took office, is testifying as a witness for the prosecution.

Prosecutors allege that city tourism and entertainment chief Kenneth Brissette and intragovernmental affairs director Timothy Sullivan conspired and proceeded to extort the Boston Calling music festival into hiring union labor in 2014, using their positions and power within the administration to pressure the festival’s executives into hiring union stagehands they didn’t want or need.

Shortly after taking the stand, Linehan acknowledged that she has been granted immunity from prosecution in this case in exchange for agreeing to testify.

And though she seemed at times a reluctant witness, Linehan’s testimony did seem to bolster what prosecutors clearly hope will be a persuasive piece of evidence when Linehan confirmed having written a memo to Mayor Walsh in 2014 saying that defendant Brissette had told Boston Calling executives they “would have to hire a few guys.”

Linehad denied, however, having any knowledge or belief that either defendant had used the threat of delayed permits or other bureaucratic maneuver to pressure Boston Calling, or that either defendant had intended to do anything other than try to resolve a simmering conflict that threatened to disrupt a popular festival.

Linehan, who managed a record label prior to joining the Walsh administration testified to having been an early advocate of Boston Calling, and said that she tried to help the festival’s executives navigate City Hall as they sought to better establish and expand the festival, and to get a wider berth from city officials when it came to various aspects of the festival, including how and when liquor could be served and, they hoped, a long-term exclusive lease to use City Hall Plaza.

Linehan said she was aware that in 2014 Boston Calling was facing increasing pressure – and antipathy – from the International Association of Stage and Theatrical Employees (IATSE) Local 11, a union based in South Boston.

IATSE members had been outraged to learn the festival was not only not hiring union labor, but had been recruiting volunteers to staff the festival who were compensated with free concert tickets in lieu of cash.

Boston Calling ended that practice – after the state attorney general became involved – but IATSE’s Local 11. continued a campaign to get the festival to hire its members.

Boston Calling’s executives declined, at least for their fall, 2014 festival, prompting Local 11. to begin planning to picket the festival.

When defendant Brissette reached out to Appel to talk about Boston Calling’s hiring some union stagehands, festival CEO Brian Appel enlisted Linehan’s help and advice, including asking her to go with him to a meeting with Brissette.

Linehan couldn’t recall the details of that meeting.

But she did confirm having written memo to her boss, Mayor Marty Walsh, around that time, expressing concern over the tensions around Boston Calling – and telling the mayor that Brissette “told them they’d have to hire a few guys.”

Defense lawyers downplayed the significance of that testimony and used cross-examination to continue building their central arguments in this case: That no one has testified to any threats, quid pro quo, or payoffs; that Boston Calling had been involved in complex and contentious negotiations with the city that had nothing to do with either defendant; and that in asking the festival to consider hiring union stagehands, the defendants were simply doing their job in trying to broker a resolution that would avoid a nasty picket and allow Boston Calling to come off a success.