SAN FRANCISCO — The crowd of people waiting to get into the Apple Store in Union Square on a Tuesday in February 2017 included tourists, shoppers, techies — and Rudy Giuliani, the newly appointed cybersecurity adviser to President Trump.

Giuliani showed up at the San Francisco store after being locked out of his iPhone, just 26 days after Trump named him cybersecurity adviser, NBC News reported Thursday, citing interviews with two sources and an internal Apple Store memo.

The former New York mayor had entered his passcode incorrectly 10 times and went to the store for help — a troubling move that suggests a sloppy approach to cybersecurity for someone so close to the president, experts said.

“There’s no way he should be going to a commercial location to ask for that assistance,” E.J. Hilbert, a former FBI cybercrime agent, told NBC, saying that Giuliani could be vulnerable to hackers and should have turned to White House technical officials for help.

The news about Giuliani’s visit to the Genius Bar comes after multiple reporters revealed he butt-dialed them from his iPhone — including an NBC reporter who said Giuliani, the president’s personal lawyer, left him an inadvertent message this month in which he could be heard discussing Bahrain and saying “the problem is we need some money.”

On Thursday, California Sen. Kamala Harris called on the State Department Inspector General to open an investigation into Giuliani’s activities abroad, citing the odd voicemail.

“These reports raise a number of serious concerns, especially given allegations that Mr. Giuliani is running a “shadow foreign policy,” Harris wrote in a letter to the inspector general, Steve Linick.

As for his 2017 appearance in San Francisco, a former Apple employee who was at the store when Giuliani sought help told NBC that the former presidential contender was waiting outside the store’s glassy facade when it opened at 10 a.m. that morning. A tech helped Giuliani erase and reboot his phone.

While black T-shirt-clad employees at the San Francisco store said Thursday they couldn’t talk to a reporter or hadn’t heard about the Giuliani news, shoppers and tourists had a laugh over Giuliani’s iPhone woes.

“That’s not a shock to anyone who’s ever heard him speak on TV,” said Mike McKinley, who carried two white Apple bags with laptops for his New York hospitality business out of the store. “He almost seems senile at this point. It’d be sad if it wasn’t so disturbing.”

Mike Sparkuhl, a surgeon from Southern California who was browsing for a new iPhone before a lunch meeting, chuckled when he heard the news.

“It speaks to how the people the president chooses play fast and loose when it comes to security,” he said. “Whether you’re talking about (Giuliani’s iPhone), or about what they did in Syria.”

Kate Prinz, who was visiting from Omaha with her husband Tom, came to the store for a similar reason as Giuliani — she was locked out of her iPhone. Its FaceID wasn’t recognizing her.

“I’m that kind of person — not very tech-savvy — but I wouldn’t think he would be,” she said of Giuliani. “America’s Mayor, that’s what he was. Now — I just don’t know.”