<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: First cmdlet always fails with limited role. in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465346#M7106</link>
    <description>&lt;P&gt;Nope. In my script I just always do some command that I know will fail so I just ignore it and move on. It's not pretty, but it works.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jan 2026 13:32:51 GMT</pubDate>
    <dc:creator>ckeith</dc:creator>
    <dc:date>2026-01-27T13:32:51Z</dc:date>
    <item>
      <title>First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/460080#M7053</link>
      <description>&lt;P&gt;I'm trying to abide by the Least Privilege model and create a role that only has the privileges needed to run a PowerShell script I plan to run that has these cmdlets:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Connect-NcController&lt;/LI&gt;&lt;LI&gt;Get-NcFile&lt;/LI&gt;&lt;LI&gt;new-ncsymlink&lt;/LI&gt;&lt;LI&gt;add-nccifssymlink&lt;/LI&gt;&lt;LI&gt;Remove-NcCifsSymlink&lt;/LI&gt;&lt;LI&gt;Remove-NcFile&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have figured out that the Connect-NcController runs a few APIs before it returns so it needs exact privileges. Here is what I have in my role so far:&lt;/P&gt;&lt;PRE&gt;&amp;gt; security login rest-role show -vserver prod1 -role createlink&lt;BR /&gt;            Role                              Access&lt;BR /&gt;Vserver     Name          API                 Level&lt;BR /&gt;----------  ------------- ------------------- ------&lt;BR /&gt;prod1       createlink     /api/cluster       readonly&lt;BR /&gt;                           /api/protocols/cifs/unix-symlink-mapping&lt;BR /&gt;                                              all&lt;BR /&gt;                           /api/storage/volumes&lt;BR /&gt;                                              readonly&lt;BR /&gt;                           "/api/storage/volumes/*/files"&lt;BR /&gt;                                              all&lt;BR /&gt;                           /api/svms          readonly&lt;/PRE&gt;&lt;P&gt;When I run&amp;nbsp;Connect-NcController, pointing to a vserver, with the credentials of the account that is assigned the limited role, it seems to connect just fine. However, no matter which cmdlet I run afterward, I get the following error:&lt;/P&gt;&lt;PRE&gt;The remote server returned an error: (403) Forbidden.&lt;/PRE&gt;&lt;P&gt;After that one failed cmdlet, the rest of them run just fine. If I authenticate with an account that has more privileges (e.g. vsadmin-volume) it doesn't have this issue. So, I assume it is a privilege problem, but I have no way of knowing which one. As far as I can tell 'security audit log show' doesn't show API calls that were declined for lack of permission so I can't figure it out that way. I already added the /api/clusters and /api/svms to get as far as I have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One oddity that I did see from 'security audit log show' was when I run with the limited role, I see this API get called, but never finish (i.e. I only see the "Pending" and not "Sucess" or "Error")&lt;/P&gt;&lt;PRE&gt;GET /api/private/cli/system/node/virtual-machine/instance/show-settings?fields=consumer :: Pending&lt;/PRE&gt;&lt;P&gt;When I run with an account with more privileges, that API call finishes. I tried giving permissions to that API path to my limited role, but it didn't seem to help, in that the problem is still there, and that API never seems to generate any results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has any ideas how to resolve this problem, I would be greatly appreciative. Is there a way to get the cmdlets to show the APIs it is making?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if you can't help with that, can you help me totally suppress the error message? I tried adding -ErrorAction SilentlyContintue but I still see an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the script I am running:&lt;/P&gt;&lt;PRE&gt;$controller = "198.19.255.116" # Vserver Management port&lt;BR /&gt;#&lt;BR /&gt;# This is the path to where you want the symbolic link to reside using&lt;BR /&gt;# a full path starting with /vol/volume_name/&lt;BR /&gt;$fileToCreate = "/vol/app1/testlink"&lt;BR /&gt;#&lt;BR /&gt;# This is where you want the link to point to. It should NOT start with&lt;BR /&gt;# /vol/volume_name/ and MUST end with a '/'. For a UNIX client, it will&lt;BR /&gt;# be redirected to this path.&lt;BR /&gt;$whereToPointTo = "/test-destination/subdir/"&lt;BR /&gt;#&lt;BR /&gt;# For a CIFS client, with a CIFS Symbolic link, they don't follow the&lt;BR /&gt;# path the UNIX link points to, it is more of a pattern match&lt;BR /&gt;# and is replaced with what $cifsPath is set to.&lt;BR /&gt;$cifsPath = "/cifspath/"&lt;BR /&gt;#&lt;BR /&gt;# If using a "wide" CIFS Symbolic link, the client can be redirected to&lt;BR /&gt;# another CIFS share as well as the path. But, in this case, we are&lt;BR /&gt;# using a "local" CIFS Symbolic Link, so the client will be redirected&lt;BR /&gt;# to the same share where the link resides.&lt;BR /&gt;$shareName = "app1"&lt;BR /&gt;#&lt;BR /&gt;# Create credentials based on the username and password above.&lt;BR /&gt;$connection = Connect-NcController -Name $controller -Credential(Get-Credential)&lt;BR /&gt;if ($connection -ne $null) {&lt;BR /&gt;  Write-Host "Connected to $controller as $username."&lt;BR /&gt;  #&lt;BR /&gt;  # Since for some strings reason the first call always fails, so just do one and ignore it.&lt;BR /&gt;  # Unfortunately, this command generates an error message no matter what I set the ErrorAction&lt;BR /&gt;  # to. There might be another command that will honor it.&lt;BR /&gt;  Get-NcFile -Path $fileToCreate -ErrorAction SilentlyContinue -WarningAction SilentlyContinue&lt;BR /&gt;} else {&lt;BR /&gt;  Write-Host "Failed to connect to $controller!"&lt;BR /&gt;  exit&lt;BR /&gt;}&lt;BR /&gt;#&lt;BR /&gt;# Check to see if the file already exists. If it does, remove it.&lt;BR /&gt;$fileProperties = Get-NcFile -Path $fileToCreate -ErrorAction SilentlyContinue -WarningAction SilentlyContinue&lt;BR /&gt;if ($fileProperties -ne $null ) {&lt;BR /&gt;  write-host "Removing cifssymlink $whereToPointTo"&lt;BR /&gt;  Remove-NcCifsSymlink -UnixPath $whereToPointTo -Confirm:$false&lt;BR /&gt;  Write-Host "Removing UNIX link $fileToCreate"&lt;BR /&gt;  Remove-NcFile -Path $fileToCreate -Confirm:$false&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;write-host "Creating new UNIX symlink $fileToCreate to $whereToPointTo"&lt;BR /&gt;new-ncsymlink –target $whereToPointTo –linkname $fileToCreate&lt;BR /&gt;write-host "Creating new cifs symlink for $whereToPointTo should redirect to $sharename$whereToPointTo$cifsPath"&lt;BR /&gt;add-nccifssymlink –unixpath $whereToPointTo -cifspath $cifsPath -locality local –sharename $shareName&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 12:40:05 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/460080#M7053</guid>
      <dc:creator>ckeith</dc:creator>
      <dc:date>2025-04-11T12:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465331#M7105</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we do have exactly the same problem using REST. We are using custom roles and with ONTAPI calls everything is working. Now we try to get everything running with REST but each time the first call of a cmdlet after the connection is established fails. We tried using RBAC roles and with REST roles, but the behaviour is the same. The second call (just using arrow up) executes successfully.&lt;/P&gt;&lt;P&gt;Did you find a solution for that?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2026 08:02:46 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465331#M7105</guid>
      <dc:creator>SAP-Basis</dc:creator>
      <dc:date>2026-01-27T08:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465346#M7106</link>
      <description>&lt;P&gt;Nope. In my script I just always do some command that I know will fail so I just ignore it and move on. It's not pretty, but it works.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2026 13:32:51 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465346#M7106</guid>
      <dc:creator>ckeith</dc:creator>
      <dc:date>2026-01-27T13:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465387#M7107</link>
      <description>&lt;P&gt;Okay, thanks. That was my first intention, but it felt so "wrong".&lt;BR /&gt;But sometimes problems just don't want to be solved &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2026 16:25:21 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/465387#M7107</guid>
      <dc:creator>SAP-Basis</dc:creator>
      <dc:date>2026-01-28T16:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466774#M7113</link>
      <description>&lt;P&gt;It tries to get the cluster version, try adding readonly access to the "/api/cluster" api endpoint&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 17:29:06 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466774#M7113</guid>
      <dc:creator>Sean2</dc:creator>
      <dc:date>2026-04-15T17:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466778#M7114</link>
      <description>&lt;P&gt;Thanks Sean2, but if you look at the first line of the output from the `security login rest-role show -vserver prod1 -role createlink` command that I listed above you will see that I already had that.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 22:49:34 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466778#M7114</guid>
      <dc:creator>ckeith</dc:creator>
      <dc:date>2026-04-15T22:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: First cmdlet always fails with limited role.</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466781#M7115</link>
      <description>&lt;P&gt;Hi Keith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried using "&lt;STRONG&gt;security login role create&lt;/STRONG&gt;" instead of "&lt;STRONG&gt;security login rest-role create&lt;/STRONG&gt;"? I seem to recall there were issues with rest role delegations. I posted an example here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/RBAC-over-RestRoles/m-p/164281" target="_blank" rel="noopener"&gt;https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/RBAC-over-RestRoles/m-p/164281&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 05:17:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/First-cmdlet-always-fails-with-limited-role/m-p/466781#M7115</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2026-04-16T05:17:44Z</dc:date>
    </item>
  </channel>
</rss>

