The NATO website has an article about Collective defence - Article 5 which reads
The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individual or collective self-defence recognized by Article 51 of the Charter of the United Nations, will assist the Party or Parties so attacked by taking forthwith, individually and in concert with the other Parties, such action as it deems necessary, including the use of armed force, to restore and maintain the security of the North Atlantic area.
Any such armed attack and all measures taken as a result thereof shall immediately be reported to the Security Council. Such measures shall be terminated when the Security Council has taken the measures necessary to restore and maintain international peace and security.
For the purpose of Article 5, an armed attack on one or more of the Parties is deemed to include an armed attack:
- on the territory of any of the Parties in Europe or North America, on the Algerian Departments of France 2, on the territory of Turkey
or on the Islands under the jurisdiction of any of the Parties in
the North Atlantic area north of the Tropic of Cancer;
According to Laws Regarding to Extraterritoriality (cited by Wikipedia)
There is a common misconception that Embassies and Consulates have extraterritoriality.
However this is qualified by
For the most part, this is not the case as extraterritoriality is not conferred upon an Embassy or Consulate, but in some situations extraterritoriality may be created by Treaty.