There are more AWS SDK examples available in the AWS Doc SDK Examples
Use UpdateSamlProvider with a CLI
The following code examples show how to use UpdateSamlProvider.
- CLI
-
- AWS CLI
-
To update the metadata document for an existing SAML provider
The following
update-saml-providerexample updates the SAML provider in IAM whose ARN isarn:aws:iam::123456789012:saml-provider/SAMLADFSwith a new SAML metadata document from the fileSAMLMetaData.xml.aws iam update-saml-provider \ --saml-metadata-documentfile://SAMLMetaData.xml\ --saml-provider-arnarn:aws:iam::123456789012:saml-provider/SAMLADFSContents of
SAMLMetaData.xml:<?xml version="1.0" encoding="UTF-8"?> <md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="https://adfs.example.com/adfs/services/trust"> <md:IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate>MIIC8DCCAdigAwIBAgIQEXAMPLE...</ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat> <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat> <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://adfs.example.com/adfs/ls/"/> <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://adfs.example.com/adfs/ls/"/> </md:IDPSSODescriptor> </md:EntityDescriptor>Output:
{ "SAMLProviderArn": "arn:aws:iam::123456789012:saml-provider/SAMLADFS" }For more information, see Creating IAM SAML identity providers in the AWS IAM User Guide.
-
For API details, see UpdateSamlProvider
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example updates the SAML provider in IAM whose ARN is
arn:aws:iam::123456789012:saml-provider/SAMLADFSwith a new SAML metadata document from the fileSAMLMetaData.xml. Note that you must use the-Rawswitch parameter to successfully process the contents of the JSON file.Update-IAMSAMLProvider -SAMLProviderArn arn:aws:iam::123456789012:saml-provider/SAMLADFS -SAMLMetadataDocument (Get-Content -Raw SAMLMetaData.xml)-
For API details, see UpdateSamlProvider in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example updates the SAML provider in IAM whose ARN is
arn:aws:iam::123456789012:saml-provider/SAMLADFSwith a new SAML metadata document from the fileSAMLMetaData.xml. Note that you must use the-Rawswitch parameter to successfully process the contents of the JSON file.Update-IAMSAMLProvider -SAMLProviderArn arn:aws:iam::123456789012:saml-provider/SAMLADFS -SAMLMetadataDocument (Get-Content -Raw SAMLMetaData.xml)-
For API details, see UpdateSamlProvider in AWS Tools for PowerShell Cmdlet Reference (V5).
-