AD Permission denied when adding a user to a group in a trusted domain - active-directory

I have 2 domains with a two way trust between them. I want to modify a group on one of the domains but running on the other domain.
Lets say the domain I am running my script on is mydomain.com, and I would like to add a user to yourdomain.com
I tried through VBScript as well as DSMod, but get permission denied
dsmod group "CN=DCComics,OU=Comics,DC=yourdomain,DC=com" -addmbr "CN=Dark Knight,OU=Comics,DC=yourdomain,DC=com"
When I run the above, I get this
dsmod failed:CN=DCComics,OU=Comics,DC=yourdomain,DC=com:Insufficient access rights to perform the operation.
I'm able to query data on yourdomain.com and I have checked the trusts are working just fine. I have logged in as administrator on mydomain.com.
Ideally I am looking to do this in VBScript, so I wrote this just to test:
user = "LDAP://CN=Clark Kent,OU=Comics,DC=yourdomain,DC=com"
group = "LDAP://CN=DCComics,OU=Comics,DC=yourdomain,DC=com"
Dim objgroup
SET objGroup = GETOBJECT(group)
objGroup.Add(user)
Once again, I get an error about permissions:
C:\tmp\foo.vbs(6, 1) Microsoft VBScript runtime error: Permission denied
Any guidance where I need to muck about with permissions for this? Might I add, I am still learning about AD, so please be gentle :)
Thanks

Being an admin in mydomain.com does not make you an admin in Yourdomain.com - trust or no trust. You need your mydomain\account added to the Administrators group in yourdomain.com

Related

you have no privileges to view this object or it does not exist

In vCenter 6.5 vSphere web client, if I logon as any user other than administrator#vsphere.local, I can't get to a few areas like Administration > Single sign on > Configuration.
I swear I did something to get my other user accounts access before, but if it's not just to give administrator access to 'global access', then I can't remember. vCenter died recently and I had to recreate it.
I'm trying to give otherUser#vsphere.local and an Active Directory group full access to do everything that administrator#vsphere.local can do.
Anyone know how to do this?
Note: I have the vCenter Server Appliance.
There's separate roles and permissions for vCenter and Appliance configurations (such as SSO). Make sure you're properly setting the permissions for those users/groups there as well.
Example of the SSO permissions: link

Insufficient privilege for operation like Get-AzureADApplication and Set-AzureADApplication

I would like to automate deployment and it requires to update settings for Azure AD Application registration.
So far I am able to :
create an Azure AD Appregistration and Service Principal with certificate (thx MS documentation)
then use command Connect-AzureAD with previous service Principal with its certificate
use command like Get-AzureADApplication -ObjectId 11111111-2222-3333-4444-555555555555
In previous bullet ObjectId 11111111-2222-3333-4444-555555555555 match with application i created on first bullet
However i am unable to execute command like:
Get-AzureADApplication -Filter "DisplayName eq '$aADApplicationame'"
and $aADApplicationame matches with application created previously
Set-AzureADApplication -ObjectId $aADApplication.ObjectId -ReplyUrls $ReplyUrls
Get-AzADServicePrincipal
I get following error message
Set-AzureADApplication : Error occurred while executing SetApplication
Code: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation
Based on my research, i set up some API permissions as follow:
Unfortunately no luck and still get insufficient privilege although all permissions were granted.
Do you know if I miss something ? Is there any specific permissions i should add to make it works ?
Regards.
As mentioned by another reply, you could give the Global Administrator role to the service principal, it is correct, but the permission of Global Administrator is too large in this case, it may cause some security issues.
In this case, the commands Get-AzureADApplication and Set-AzureADApplication you used essentially call the Azure AD Graph API, so to solve the issue, a better solution is to add the permission of Azure AD Graph API, please follow the steps below.
1.Navigate to the API permissions of your AD App -> select Azure Active Directory Graph(not Microsoft Graph).
2.Select Application permissions(not Delegated permissions) -> Application.ReadWrite.All -> click Add permissions.
3.At last, click the Grant admin consent for xxx button.
After a while, try the commands again, it will work fine.
Update:
After I check the doc, I find there are already some new commands released by MS which call the Microsoft Graph, haven't seen them before.
e.g. In your case, you can use Get-AzureADMSApplication instead of Get-AzureADApplication.
Get-AzureADMSApplication -Filter "DisplayName eq 'joyttt'"
Use Set-AzureADMSApplication instead of Set-AzureADApplication.
Set-AzureADMSApplication -ObjectId <object-id> -Web #{ RedirectUris = "https://mynewapp.contoso.com/" }
For Get-AzADServicePrincipal, there is no equivalent currently, there should be one in the future. When using the commands above, the permissions of Microsoft Graph will work, no need to use Azure AD Graph, but you should use Application permission, not Delegated permission (you used the Delegated permission in your question.)
You are facing this issue because Powershell cmdlet works differently than compared to MS Graph. Instead of permissions, Powershell require roles to do this operations. Please add Global Administrator role to your service principle and then try the Connect-AzureAD so that, the issue will be fixed.
For more details, you may refer to Assigning administrator roles in Azure Active Directory.
I was also facing similar issue, make sure are doing below two things:
Set Run as account for azure automation account
In newly created app registration for azure automation account after setting Run as account, make sure you add Cloud application administrator role explicitly.
Add API permission for Application.ReadWrite.All (Microsoft graph)
In my case the app registration was showing cloud application administrator role under Roles and Administrator screen, which I thought gives the new app registration required permission but that was not the case. PowerShell script only worked after we assigned the cloud application administrator role explicitly.
In the beginning thanks for previous posts it gave a lot of inspiration according topic. Problem occurred in our case at automated bicep mechanism that is supposed to add API permissions for Microsoft Graph.
Error: Authorization_RequestDenied
Solution:
We needed to give Enterprise Application running mechanism Microsoft Graph (not Azure Active Directory Graph it will be deprecated) Application permissions:
Application.ReadWrite.All
AppRoleAssignment.ReadWrite.All
Directory.ReadWrite.All

assign permission to group managed service account

I have been advised that it is better to run a scheduled task as a Group Managed Service Account (gMSA) rather than as a domain user account. I can find plenty of information about how to create the gMSA, and how to configure the scheduled task to run as that gMSA, but all of the tutorials and training I have found stop there. I can't find any information on how to assign permission to that gMSA.
For example, a scheduled task needs permission to write to a folder. Normally, if the scheduled task is running as a domain user, I would go into the properties for that folder and set the security so that the domain user has write permission. But I am finding that I cannot give a gMSA permission in the same way.
What am I misunderstanding about gMSAs?
I have not find a way to assign permissions to a GMSA directly to the file system. My workaround is to add the GMSA account to an AD group and then assign permissions to the group.

Permission of sqlserver doesn't exist but with sa exists

I have a problem with sqlserver authentication .
When i connect to my instance using this information local,windows authentican i have this permission :
But with sqlserver authentication local,sa,12345 i have this permission:
Last day the both permissions was same ,but today the permission of windows authentication are removed and i need the permission of sqlauthentication in windowsauthentication how can i do that?
because my TFS use the windows authentication login .now my TFS doesn't work.
Best regards
i need the permission of sqlauthentication in windowsauthentication how can i do that?
No, you don't. The reason that your sa account can see all of those other logins is because it is a system administrator (i.e. a member of the sysadmin server role). Whatever you're doing with TFS, I can almost guarantee that it doesn't need that level of permission. Find out what permissions you actually need (this looks like a promising start) and grant those. Running any application with privileges it doesn't need is a bad idea in general.

SQL Server 2005 "public" database role doesn't seem to apply?

I have a SQL Server 2005 database that I'm trying to access as a limited user account, using Windows authentication. I've got BUILTIN\Users added as a database user (before I did so, I couldn't even open the database). I'm working under the assumption that everybody is supposed to have permissions for the "public" role applied to them, so I didn't do anything with role assignment. Under tblFoo, I can use the SSMS Properties dialog (Permissions page) to add "public", then set explicit permissions. Among these is "Grant" for SELECT. But running
SELECT * from tblFoo;
as a limited (BUILTIN\Users) account gives me an error "Select permission denied on object 'tblFoo', database 'bar', schema 'dbo'". In the properties dialog, there's an "Effective Permissions button, but it's greyed out.
Further, I tried creating a non-priv account called "UserTest", adding that at the server level, then mapping it down to the "bar" database. This let me add UserTest to the "Users or Roles" list, which let me run "Effective Permissions" for the account. No permissions are listed at all -- this doesn't seem right. The account must be in public, and public grants (among other things) Select on tblFoo, so why doesn't the UserTest account show an effective permission? I feel like I'm going a bit crazy here.
ASIDE: I am aware that many people don't like using the "public" role to set permissions. This is just my tinkering time; in final design I'm sure we'll have several flexible (custom) database roles. I'm just trying to figure out the behavior I'm seeing, so please no "don't do that!" answers.
UPDATE: Apparently I know just enough SQL Server to be a danger to myself and others. In setting permissions (as I said, "among others"), I had DENY CONTROL. When I set this permission, I think I tried to look up what it did, had a vague idea, and decided on DENY. I cannot currently recall why this seemed the thing to do, but it would appear that that was the reason I was getting permission failures. So I'm updating my question: can anyone explain the "CONTROL" permission, as it pertains to tables?
You only need to have SELECT rights. In raw SQL (see the "script" icon/button in your dialogue box), it's GRANT SELECT ON dbo.tblFoo to public. This is the only permission needed to view the data,
In this case, the error message explicitly mentions "deny". "DENY" is a right in itself, so it mentions it,
If you had no rights, you'd get the message (very approximately) "tblFoo does not exist or you do not have rights"
"DENY CONTROL" is mentioned here. In this case, you denied all rights to the public role.
The grantee effectively has all
defined permissions on the securable
Assuming "UserTest" is a domain user account, connect as a member of the sysadmin role and run
EXEC MASTER.dbo.xp_logininfo 'Domain\UserTest', 'all'
(substituting your domain name for "Domain")
this will display the Windows groups etc. that the account is inheriting security permissions from and the level of access, e.g. you would expect to see something like:
account name type privilege mapped login name permission path
domain\usertest user user domain\usertest BUILTIN\Users
This will help troubleshoot where the account is inheriting permissions from, e.g. which Windows groups it is part of that have permissions to the database. If this all looks OK then I would follow your own advice and not mess with the public role.
Create a database role in your
database
Assign explicit permissions for that
role
Create a server login for your user
account
Open the server login, go to the
User Mapping section, click on the
database and select the database
role you created

Resources