From a4e435677ce4e93594f65f6f68a8efe84ca08cac Mon Sep 17 00:00:00 2001 From: Hossein Rouhani <56231339+HRouhani@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:34:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20fixing=20a=20bug=20in=20NamedLoc?= =?UTF-8?q?ation=20under=20confitional=20access=20-=20MS365=20(#4845)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hossein Rouhani --- providers/ms365/resources/conditional-access.go | 4 ++++ providers/ms365/resources/ms365.lr.go | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/providers/ms365/resources/conditional-access.go b/providers/ms365/resources/conditional-access.go index 9a5389396d..773f4d2c74 100644 --- a/providers/ms365/resources/conditional-access.go +++ b/providers/ms365/resources/conditional-access.go @@ -11,6 +11,10 @@ import ( "go.mondoo.com/cnquery/v11/providers/ms365/connection" ) +func (m *mqlMicrosoftConditionalAccessIpNamedLocation) id() (string, error) { + return m.Name.Data, nil +} + func (a *mqlMicrosoftConditionalAccess) namedLocations() ([]interface{}, error) { conn := a.MqlRuntime.Connection.(*connection.Ms365Connection) graphClient, err := conn.GraphClient() diff --git a/providers/ms365/resources/ms365.lr.go b/providers/ms365/resources/ms365.lr.go index 97b809e020..d0d7f8b45c 100644 --- a/providers/ms365/resources/ms365.lr.go +++ b/providers/ms365/resources/ms365.lr.go @@ -2926,7 +2926,12 @@ func createMicrosoftConditionalAccessIpNamedLocation(runtime *plugin.Runtime, ar return res, err } - // to override __id implement: id() (string, error) + if res.__id == "" { + res.__id, err = res.id() + if err != nil { + return nil, err + } + } if runtime.HasRecording { args, err = runtime.ResourceFromRecording("microsoft.conditionalAccess.ipNamedLocation", res.__id)